HARDWARE ACCELARATES AND NETWORKS
1. Name the important terms of RTOS?
Task
State Scheduler Shared data Reentrancy
2. Define process.
Process
is a computational unit that processes on a CPU under the control of a
scheduling kernel of an OS. It has a process structure, called Process control
block. A process defines a sequentially executing program and its state.
3. What is meant by PCB?
Process
Control Block’ is abbreviated as PCB.PCB is a data structure which contains all
the information and components regarding with the process.
4. Draw the process state transitions?
5. Define task and Task state.
A task is
a set of computations or actions that processes on a CPU under the control of a
scheduling kernel. It also has a process control structure called a task
control block that saves at the memory. It has a unique ID. It has states in
the system as follows: idle, ready, running, blocked and finished
6. Define Task Control Block (TCB)
A memory
block that holds information of program counter, memory map, the signal
dispatch table, signal mask, task ID, CPU state and a kernel stack.
7. What is a thread?
Thread is
a concept in Java and UNIX and it is a light weight sub process or process in
an application program. It is controlled by the OS kernel. It has a process
structure, called thread stack, at the memory. It has a unique ID .It have
states in the system as follows: stating, running, blocked and finished.
8. Define Inter process communication.
An output
from one task passed to another task through the scheduler and use of signals,
exception, semaphore, queues, mailbox, pipes, sockets, and RPC.
9. What is shared data problem?
If a
variable is used in two different processes and another task if interrupts
before the operation on that data is completed then the value of the variable
may differ from the one expected if the earlier operation had been completed
.This ids known as shared data problem.
10. Define Semaphore.
Semaphore
provides a mechanism to let a task wait till another finishes. It is a way of
synchronizing concurrent processing operations. When a semaphore is taken by a
task then that task has access to the necessary resources. When given the
resources unlock. Semaphore can be used as an event flag or as a resource key.
11. Define Mutex.
A
phenomenon for solving the shared data problem is known as semaphore. Mutex is
a semaphore that gives at an instance two tasks mutually exclusive access to
resources.
12. Differentiate counting semaphore and binary
semaphore.
Binary semaphore
When the
value of binary semaphore is one it is assumed that no task has taken it and
that it has been released. When the value is 0 it is assumed that it has been
taken.
Counting semaphore
Counting
semaphore is a semaphore which can be taken and given number of times. Counting
semaphores are unsigned integers.
13. What is Priority inversion?
A problem
in which a low priority task inadvertently does not release the process for a
higher priority task.
14. What is Deadlock situation?
A set of
processes or threads is deadlocked when each process or thread is waiting for a
resource to be freed which is controlled by another process.
15. Define Message Queue.
A task
sending the multiple FIFO or priority messages into a queue for use by another
task using queue messages as an input.
16. Define Mailbox and Pipe.
A message
or message pointer from a task that is addressed to another task.
17. Define Socket.
It
provides the logical link using a protocol between the tasks in a client server
or peer to peer environment.
18. Define Remote Procedure Call.
A method
used for connecting two remotely placed methods by using a protocol. Both
systems work in the peer to peer communication mode and not in the client
server mode.
19. What are the goals of RTOS?
Facilitating
easy sharing of resources
Facilitating
easy implantation of the application software
Maximizing
system performance
Providing
management functions for the processes, memory, and I/Os and for other
functions for which it is designed.
Providing
management and organization functions for the devices and files and file like
devices.
Portability
Interoperability
Providing
common set of interfaces.
20. What is RTOS?
An RTOS
is an OS for response time controlled and event controlled processes. RTOS is
an OS for embedded systems, as these have real time programming issues to
solve.
21. List the functions of a kernel.
Process
management
Process
creation to deletion
Processing
resource requests
Scheduling
IPC
Memory
management
I/O
management
Device
management
22. What are the two methods by which a running
requests resources?
• Message
• System call
23. What are the functions of device manager?
Device
detection and addition
Device
deletion
Device
allocation and registration
Detaching
and deregistration
Device
sharing
24. List the set of OS command functions for a
device
Create
and open
Write
Read
Close and
delete
25. List the set of command functions of POSIX file
system
Open
Write
Read
Seek
Close
26. What are the three methods by which an RTOS
responds to a hardware source call on interrupt?
Direct
call to ISR by an interrupt source
Direct
call to RTOS by an interrupt source and temporary suspension of a scheduled
task.
Direct
call to RTOS by an interrupt source and scheduling of tasks as well as ISRs by
the RTOS.
27. Name any two important RTOS.
MUCOS
VxWorks
28. Write short notes on Vxworks?
Vxworks
is a popular Real-time multi-tasking operating system for embedded
microprocessors and systems.
Vxworks
can run on many target processors.
It is a
UNIX like Real time operating system.
More Reliable
More faster
29. What is meant by well tested and debugged RTOS?
An RTOS
which is thoroughly tested and debugged in a number of situations.
30. What is sophisticated multitasking embedded
system?
A system
that has multitasking needs with multiple features and in which the tasks have
deadlines that must be adhered to.
31. What are the features of UC/OS II?
Preemptive
Portable
Scalable
Multitasking
32. What is MICRO C/OS II?
· It stands for micro-controller operating system(UC/OS II).
· It is a real time kernel
· The other names of MICROC/OS II are MUCOS and UCOS.
· The codes are in ‘C’ and Assembly language.
33. What are the real time system level functions
in UC/OS II? State some?
1. Initiating
the OS before starting the use of the RTOS fuctions.
2
Starting the use of RTOS multi-tasking functions and running the states. 3
Starting the use of RTOS system clock.
34. Write the interrupt handling functions?
int
connect ( ) is the function for handling the Interrupt. int Lock ( ) ->
Disable Interrupts.
int
unlock( ) -> Enable functions.
35. Write down the seven task priorities in
embedded 'C++'?. define Task _Read ports priority
define
Task _Excess Refund priority define Task _Deliver priority
define
Task _Refund priority define Task _Collect priority define Task _Display
priority
define
Task _Time Date Display priority
36. Name any two mailbox related functions.
OS_Event
*OSMboxCreate(void *mboxMsg)
Void
*OSMboxAccept(OS_EVENT *mboxMsg)
37. Name any two queue related functions for the
inter task communications.
· OS_Event OSQCreate(void
**QTop,unsigned byte qSize)
· Unsigned byte OSQPostFront(OS_EVENT *QMsgPointer,void *qmsg)
38. How is Vx Works TCB helpful for tasks?
Provide
control information for the OS that includes priority, stack size, state and
options.
CPU
context of the task that includes PC, SP, CPU registers and task variables.
39. What are the various features of Vx Works?
VxWorks
is a scalable OS
RTOS
hierarchy includes timers, signals, TCP/IP sockets, queuing functions library,
Berkeley ports and sockets, pipes, UNIX compatible loader, language
interpreter, shell, debugging tools, linking loader for UNIX.
40. What is an active task in the context of Vx
Works?
Active
task means that it is in one of the three states, ready, running, or waiting.
41. What are the task service functions supported
by Vx Works?
taskSpawn()
taskResume()
taskSuspand()
taskDelay()
taskSuspand()
taskInit()
exit()
taskDelete()
42. Name any four interrupt service functions
supported by Vx Works?
intLock()
intVectSet()
intVectGet()
intContext()
43. Name some of the inter process communication
function.
semBCreate()
semMCreate()
semCCreate()
semTake()
semDelete()
44. Name some of the inter process communication
function used for messaging.
msgQCreate()
msgQDelete()
msgQSend()
msgQReceive()
45. What are Vx Works pipes?
VxWorks
pipes are thec queues that can be opened and closed like a pipe.pipes are like
virtual IO devices that store the messages as FIFO.
46. What are the different types of scheduling
supported by Vx Works?
Preemptive
priority
Time
slicing
47. What are the task service functions supported
by MUCOS?
Void
OSInit (void)
Void
OSStart(void)
voidOSTickInit(void)
void
OSIntEnter(void)
void
OSIntExit(void)
48. What are the semaphores related functions
supported by MUCOS?
OS_Event
OSSemCreate(unsigned short sem val)
Void
OSSemPend(OS_Event *eventPointer,unsigned short timeout,unsigned byte
*SemErrPointer)
unsigned
short OSSemAccept(OS_Event*eventPointer)
unsigned
short OSSemPost(OS_Event*eventPointer)
1. Explain the goals of operating system services.
Definition
An
operating system (os) is Software that shares a computer system's resources
(processor, memory, disk space, network, bandwidth and so on) between user’s
.and tie
application
programs they run
Goals
The OS
goals are perfection and correctness to achieve the following
To hide
details of hardware by creating abstraction
To
allocate resources to process
Effective
user interface
Structure
When
using an OS, the processor in the system runs in two modes.
User mode:
The user
process is permitted to run and use only a subset of functions and instructions
in the OS.
Supervisory mode:
The OS
runs the privileged functions and instructions in protected mode and OS. A
system can be assumed to have a startup as per below table
Kernel
The
kernel is the central component of most computer operating systems (OS). Its
responsibilities include managing the system's resources
Process management
Every
program running on a computer, be it a-service or an application, is a process.
Most operating systems enable concurrent execution of many processes and
programs at once via multitasking, even with one CPU.
On the
most fundamental of computers multitask is done by simply switching process
quickly.
Depending
on the operating system, as more processes run, either each time slice will
become smaller or there will be a longer delay before each process is given a
chance to run.
Process
management involves computing and distributing CPU time as well as other
resources.
Most
operating systems allow a process to be assigned a priority which affects its
allocation of CPU time.
Interactive
operating systems also employ some level of feedback in which the task with
which the user is working receives higher priority.
Memory management
An
operating system's memory manager coordinates the use of these various types of
memory by tracking which can is available, which is to be allocated or deal
located and how to move data between them. This activity, usually referred to
as virtual memory management,
increases
the amount of memory available for each process by making the disk storage seem
like main memory. There is a speed penalty associated with using disks or other
slower’ storage as
memory -
if running processes require significantly more RAM than is available, the
system may start thrashing. This can happen either because one process requires
a large amount or because
two or
more processes compete for a larger amount of memory than is available. This
then leads to constant transfer of each process’s data to slower storage.
Another important part of memory
management
is managing virtual addresses. If multiple processes are in memory at once,
2. Explain the three alternative systems in three
RTOS for responding a hardware source call with the diagram.
There are
three alternative systems for the RTOSs to respond to the hardware source calls
from the interrupts.
Direct call to ISR by an Interrupting Source
A
hardware source calls an ISR directly, and ISR just sends a message to the
RTOS. On an interrupt the process running at the CPU is interrupted and the ISR
corresponding to that source starts executing.
RTOS is
simply sent a message from the ISR into a mailbox or message queue. It is to
inform the RTOS about which ISR has taken control of the CPU.
The ISR
continues execution of the codes needed interrupt service. The routine sends a
message for the RTOS.The message is stored at the memory allotted for RTOS
messages.
When TSR finishes, the RTOS returns to the interrupted process or reschedules the processes. RTOS action depends on the messages at the mailbox.
Direct call to RTOS by an Interrupting Source and
temporary Suspension of a Scheduled Task
The ISR
send a message for initializing the task and returns after restoring the
context. The messages are stored at the memory allotted for RTOS messages.
The RTOS
now initiates the task to ready state to later encode needed for the interrupt
service. The ISR must be short and it simply places the messages. It is the
task that runs the remaining codes whenever it is scheduled. RTOS schedules
only- the .processes) and switches the contexts between the tasks only.
ISR
executes only during a temporary suspension of a task.
Direct call to RTOS by an Interrupting Source and
Scheduling of Tasks as well as IRS by the RTOS
The RTOS
intercepts and executes the task needed on return from the ISR without any
message for the task from the ISR. This is shown below
The
routine doesn't T4 any messages but memory sends the IPCs for the needed
parameters for a task. Parameters are stored at the memory allotted for the
RTOS inputs.
The RTOS
now calls return and restoration of the context and switches the run later the
codes needed for the any other task.
The ISR
need not be short and simply generates and saves as the IPCs the input
parameters. It is the task that runs the codes whenever RTOS schedules not only
the tasks but also the ISRs and switches the contexts as well as the tasks as
well as the ISRs.
3. Explain the scheduler in which RTOS insert into
the list and the ready task for sequential execution in a co-operative round
robin model.
Cooperative
means that each ready task cooperates to let a running one finish. None of the
tasks does a block anywhere during the ready to finish states. Round robin
means that each ready state runs in turn only from the circular queue. The
service is in the order in which a task is initiated on interrupt.
Worst-case
latency is same for each task. It is tcycle
The
worst-case latency with this scheduling will be
dt- event
detection time
st-
switching time from one task to another
et -task
execution time
4. Explain the use of Semaphores for a Task or for
the Critical Sections of a Task.
Use of a Single Semaphore
Semaphore
provides a mechanism to let a task wait till another finishes. It is a way of
synchronizing concurrent process operations. When a semaphore is 'taken' by a
task, then that task has to access to the necessary resources; when given, the
resources unlock. Semaphore can be used as an event flag or as a resource key.
Resource key is one that permits use of resources like CPU, memory or other
functions or critical section codes
Semaphore,
which is a binary Boolean variable (or it is a signaling variable or notifying
variable.)Used as event flag. Semaphore is called binary semaphore when its
value is 0 and it is assumed that it has Boolean taken. When its value is l, it
is assumed that no task has taken it and that it has been released.
Use of Multiples Semaphores
Consider
two semaphores. A task I when executing a critical section notifies the os to
take the semaphore. os returns information that the semaphore has been taken to
l and M. Now, the task I executes the codes of the critical. The OS having been
notified about a take semaphore x from I, does not take and OS does not release
the o task J and M' But the os returns an semaphore at an instance.
Use of Mutex
Mutex is a semaphore that gives at an instance two tasks mutually exclusive access to resources. Use of mutex facilitates mutually exclusive access by two or more process to the resource (CPU). The same’ variable, sem_m, is shared between the various processes. Let
process
and process 2 share sem_m and its initial value = l.
Process’s
1 proceeds after sem_m decreases and equals 0 and gets the exclusive access to
the CPU.
Process I
ends after sem_m increases and equals l; process 2 can now gets exclusive
access to the CPU.
5. Explain the Rate Monotonic Co-operative
scheduling.
Cooperative
means that each ready task cooperates to let a running one finish. None of the
tasks does a block anywhere during the ready to finish states. Round robin
means that each ready state runs in turn only from the circular queue. The
service
is in the
order in which a task is initiated on interrupt.
Worst-case
latency is same for each task. It is tcycle .
The
worst-case latency with this scheduling will be:
dt- event
detection time
st-
switching time from one task to another
et -task
execution time
There is
cooperative scheduling and each ready task cooperates to let the running one
finish. None of the tasks does a block anywhere from the start to finish. Here,
however, in case of cyclic scheduling, the round robin is among the ready tasks
that run in turn only from a priority wise ordered list. The ordering is
according to the precedence of interrupt source and the task.
The RTOS
scheduler first executes only the first task at the ordered list, and the
tcycle equals the period taken by the first task on the list. It is deleted
from the list after the first task is executed and the next task becomes the
first. Now, if the task in the ordered list is executed in a cyclic order, it
is called Cyclic Priority based cooperative Scheduler.
The
insertions and deletions for forming the ordered list are made only at the
beginning of each cycle.
Let Pem,
be the priority of that task which has the maximum execution time. Then worst
latencies for the highest priority and lowest priority tasks will now vary from
6. Explain the features of Vx Works.
VxWorks
is a Unix-like real-time operating system made and sold by Wind River Systems
of Alameda, California" USA. Like most RTOSes, VxWorks includes a
multitasking kernel with pre-emptive scheduling and fast interrupt response,
extensive inter-process communications and synchronization facilities, and a
file system Major distinguishing features of VxWorks include efficient
POSlX-compliant memory management, microprocessor facilities, a shell for user
interface, symbolic and source level debugging capabilities, and performance
monitoring. VxWorks is generally used in embedded systems. Unlike "native"
systems such as UNIX and Forth, VxWorks development is done on a
"host" machine running Unix or Windows, crosscompiling target
software to run on various "target" CPU architectures as well as on
the "host" by means of VxSim. VxWorks has been ported to a number of
platforms and now runs on practically any modern CPU that is used in the
embedded market. This includes the x 86 families, MIPS, PowerPC, SH-4 and the
closely related family of ARM, StrongARM and xScale CPUs
VxWorks System Functions and System Tasks
The first
task that a scheduler executes is UsrRoot from the entrv point of usrRoot0 in
file
install/Dir/target
/config/alI / usr/Confi g. c.
It spawns
the VxWorks tools and the following tasks. The root terminates after all the
initializations. Any root task can be initialized or terminated. The set of
functions, tlog Task, logs the system message without current task context I/O.
Interrupt handling functions
An
internal hardware device auto generates an interrupt vector address, ISR-
ECTADDR as per the device. Exceptions are defined in the us6r software.
ISR Design
ISR have
the highest priority and can preempt any running task.
An ISR
inhibits the execution of the tasks till return’.
An IRS
does not execute like a task and does not have regular task context. It has
special interrupt context'
While
each task has its own stack" unless and otherwise not permitted -by a
special architecture of a System or a processor
An ISR
should not wait for taking the semaphore or other IPC.
ISR
should just write the required data at the memory or post an IPC so that it has
short codes and most of its functions, execute at tasks.
ISR
should not use flodting-point functions as these takes longer time to execute.
Signals and interrupt handling functions
Function
'void sigHandler(int sigNum)' declares a signal servicing routine for a signal
identified by sigNum and a signal servicing routine registers a signal as
follows:
Signal
(sigNum, sigISR). The parameters that pass are the sigNum and signal servicing
routine name, sigISR.A pointwer pSigCtx associates with the signal context. The
signal xcontewxt savwes PC, SP, registers, etc. like an ISR context.
The
signal ISR calls the following functions:
Call
taskRestart0, to restart the task which generated the sigNum.
Call
exit0 to terminate the task, which generated the sigNum.
Call
longiumpO. This results in starting the. Execution from a memory location.
7. Explain the RTOS programming tool MicroC/OS-II.
MicroC/O$II
(commonly termed PC/O$II or mC/OSi-il), is a low-cost priories-based
pie-emptive real time multitasking operating system kernel for microprocessors,
written mainly in the C fodarnming language. It is mainly intended for use in
embedded systems.
Ports
It has
ports for most popular processors and boards in the market and is suitable for
use in safety critical embedded systems such as aviation, medical systems and
nuclear installations.
Task states
pC/OS-[
is a multitasking operating system. Each task is an infinite loop and can be in
any one of the following 5 states:
Dormant
Ready
Running
Waiting
ISR
Source files
There are
two types of source files.
Master
header files includes the #include preprocessor commands for all the files of
both
types. It
is referred to as include.h file Preprocessor dependent
Source files
Two
header files at the master are the following:
os_cpu.h
is the processor definition header file.
The
kernel building configuration file is os-cfg.h.
Further
two C file are the ISRs and RTOS timer
specifying
osjick.c and processor C codes os_cpu_c.c
Processor independent source file
Two
files, MUCOS header and C files, are cos.ii.h and ucos.ii.c. The files for the
RTOS core, timer and task are os_colt.c os_time.c and os_task.c. The other
codes are in os_mem.c, os_sem.c, os_q.c and os_mbox.c
It is a
mandatory to use a well tested and debugged RTOS in a sophisticated
multitasking embedded system.
MUCOS and
VxWorks are two important RTOS. MUCOS handles and schedules the task and ISRs
.
8. Explain RTOS system level functions with an
example
MUCOS has
system level functions. These are for RTOS initiation and start, RTC ticks
initiation and the ISR enter and exit functions.
Functions in this table pass no arguments and
return type is void.
There is
a global variable,OslntNesting.which increments on entering ISR.Global variable
OSlntNesting decrements on'exit"from an ISR. Initiating the operating
$)stem before starting the use of the RTOS functions
Function
void OSInit (void) operating system.
Its use
is compulsory before functions.
It
returns no parameter.
Starting use of RTOS multitasking functions and
returning the tasks
Function
void OSStart(void) is used to start the initiated operating system and
create
tasks.
Its use
is compulsory for the multitasking OS kernel operations.
It
returns no parameter.
Starting the RTOS System clock
Function
void OsTicklnit(void) is used to initiate the system clock ticks and interrupts
at regular intervals as per OS_TICKS_PER_SEC predefined during configuring the
MUCOS.
Its use
is compulsory for the multitasking OS kernel operations when the timer
functions ane to be used.
It
returns no parameter.
Sending message to RTOS taking control al the start
of an ISR
Function
void OSlntEnter(void) is used at the start of an ISR.
It is for
sending a message to RTOS kernel for taking control. Its use is compulsory to
let the multitasking OS kernel, control the nesting of the ISRs in case of
occurrences of multiple interrupts of varying priorities.
It
returns no parameter.
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2024 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.