Chapter-3 Real Time OS
Chapter-3 Real Time OS
Chapter-3 Real Time OS
Chapter-3
Aside from the minute details, two prevailing design philosophies affect RTOS design:
monolithic kernel versus microkernel.
These systems are differentiated by their structure; whereas monolithic kernel systems
run in a single space, microkernel systems compartmentalize different components of
the architecture.
1. Microkernel Systems
In microkernel architecture, components are stored in separate “rooms,” which are
independent from one another but share a similar space. A room can be renovated
without impacting those around it. However, to get from one to another, you have to
step through the doorway and head down the hall, which wastes time. Any action has to
return to the kernel before it can move to the component it references, meaning some
operations take much longer than necessary.
2. Monolithic Systems
In a monolithic system, there are no “walls” between the rooms, so you can step from
one to another much more quickly. Rather than implementing a small kernel, monolithic
kernels provide services of their own as well as regulating those of other areas. With
exceptions, operations are executed in the kernel space, removing the recurrent need to
return to the kernel and improving speed and performance. However, making a change
in one area could have ramifications for the entire system.
Word size
2/26/2024 Prepared By; Elias B. 21
Clock Speed
The Attributes of the process are used by the Operating System to create the process control block
(PCB) for each of them. This is also called context of the process. Attributes which are stored in the
PCB are described below.
1. Process ID
When a process is created, a unique id is assigned to the process which is used for unique
identification of the process in the system.
2. Program counter
A program counter stores the address of the last instruction of the process on which the process was
suspended. The CPU uses this address when the execution of this process is resumed.
3. Process State
The Process, from its creation to the completion, goes through various states which are new, ready,
running and waiting. We will discuss about them later in detail.
4. Priority
Every process has its own priority. The process with the highest priority among the processes gets
the CPU first. This is also stored on the process control block.
5. General Purpose Registers
Every process has its own set of registers which are used to hold the data which is generated during
the execution of the process.
6. List of open files
During the Execution, Every process uses some files which need to be present in the main memory.
OS also maintains a list of open files in the PCB.
7. List of open devices
OS also maintain the list of all open devices which are used during the execution of the process.
2/26/2024 Prepared By; Elias B. 34
Process states
1. Creation
Once the process is created, it will be ready and come into the ready
queue (main memory) and will be ready for the execution.
2. Scheduling
Out of the many processes present in the ready queue, the Operating
system chooses one process and start executing it. Selecting the process
which is to be executed next, is known as scheduling.
3. Execution
Once the process is scheduled for the execution, the processor starts
executing it. Process may come to the blocked or wait state during the
execution then in that case the processor starts executing the other
processes.
4. Deletion/killing
Once the purpose of the process gets over then the OS will kill the
process. The Context of the process (PCB) will be deleted and the process
gets terminated by the Operating system.
1 . Preemptive scheduling algorithms allow the RTOS to interrupt a running task and switch to a
higher-priority task. This is important for ensuring that critical tasks meet their deadlines, even if lower-
priority tasks are already running.
2. Non-preemptive scheduling algorithms do not allow the RTOS to interrupt a running task. This can
be useful for tasks that need to run to completion without being interrupted, but it can also lead to missed
deadlines for higher-priority tasks if a lower-priority task takes a long time to complete.
To get rid of the problem of wasting the wake-up signals, Dijkstra proposed
an approach which involves storing all the wake-up calls.
Dijkstra states that, instead of giving the wake-up calls directly to the
consumer, producer can store the wake-up call in a variable. Any of the
consumers can read it whenever it needs to do so.
Semaphore is the variables which stores the entire wake up calls that are
being transferred from producer to consumer.
It is a variable on which read, modify and update happens automatically in
kernel mode.
Semaphore cannot be implemented in the user mode because race
condition may always arise when two or more processes try to access the
variable simultaneously. It always needs support from the operating
system to be implemented.
According to the demand of the situation, Semaphore can be divided into
two categories.
Counting Semaphore
Binary Semaphore or Mutex
2/26/2024 Prepared By; Elias B. 128
Counting Semaphore