Professional Documents
Culture Documents
M T M P: Ulti Asks and Ultiple Rocesses
M T M P: Ulti Asks and Ultiple Rocesses
3. CPU Metrics:
Initial Time – the time at which a process actually starts executing on CPU.
Completion Time – the time at which a process finishes its work.
The total CPU time consumed by a set of process is
MULTI TASKS AND MULTIPLE PROCESSES
Utilization
1. Cyclostatic Scheduling:
Also called as TDMA scheduling.
In this the hyper period is divided into equal sized time slot.
Factors affect utilization
the number of time slot used
the fraction of time slot used for useful work.
MULTI TASKS AND MULTIPLE PROCESSES
2. Round Robin:
Time slot is allocated only for useful work
Priority – P1 Priority – P2
PRIORITY BASED SCHEDULING
2. Earliest Deadline First Scheduling:
EDF assigns priorities in order of deadline.
However, the final step of the OS during the scheduling procedure is the
same as for RMS—the highest-priority ready process is chosen for
execution.
PRIORITY BASED SCHEDULING
INTERPROCESS COMMUNICATION
The data and control signal transfer between processes.
2 ways
Blocking
Non Blocking
2 major style of interprocess communication
Shared memory communication
Message Passing
Shared Memory:
• Flag
• Test and set
• Semaphore
INTERPROCESS COMMUNICATION
Message Passing:
Signal:
EVALUATING OPERATING SYSTEM PERFORMANCE
Context Switching:
In practical switching from one process to another (context switching)takes
some time.
Cache Miss:
The cache causes the execution of one program to influence the execution
time of other program.
The cache miss rate can’t be predicated as it varies from single miss to all
instruction miss.
POWER MANAGEMENT AND OPTIMIZATION FOR PROCESSES
The power management policy is a strategy for determining when to
perform certain power management operations.
3 states
Active state
Sleep Mode
Predictive shutdown
Fixed time shutdown
Advanced Configuration and Power Interface ( ACPI )
POWER MANAGEMENT AND OPTIMIZATION FOR PROCESSES
ACPI supports the following five basic global power states:
G3, the mechanical off state, in which the system consumes no power.
G2, the soft off state, which requires a full OS reboot to restore the
machine to working condition. This state has four substates:
S1, a low wake-up latency state with no loss of system context
S2, a low wake-up latency state with a loss of CPU and system
cache state
S3, a low wake-up latency state in which all system state except
for main memory is lost
S4, the lowest-power sleeping state, in which all devices are
turned off.
G1, the sleeping state, in which the system appears to be off and the time
required to return to working condition is inversely proportional to power
consumption.
G0, the working state, in which the system is fully usable.
The legacy state, in which the system does not comply with ACPI.
POSIX
The Portable Operating System Interface (POSIX) is a family of standards specified by
the IEEE Computer Society for maintaining compatibility between operating systems.
POSIX defines the application programming interface (API), along with command
line shells and utility interfaces, for software compatibility with variants of Unix and
other operating systems.
fork() Example:
• The function fork( ) is used #include <stdio.h>
to create a new process #include <string.h>
called child process. #include <sys/types.h>
#define MAX_COUNT 200
• In POSIX a new process is #define BUF_SIZE 100
created by making a copy of void main(void)
an existing process (parent {
process). pid_t pid; int i; char buf[BUF_SIZE];
fork();
• Each process has same pid = getpid(); f
variable names but different or (i = 1; i <= MAX_COUNT; i++)
memory. {
sprintf(buf, "This line is from pid %d,
• A parent process gets a value = %d\n", pid, i);
return value of child ID. write(1, buf, strlen(buf));
While a child process gets }
return value of 0 }
POSIX
POSIX
execv()
This function is used to create a child function with only required code.
It takes a list of arguments to the process in the form of an array, just as would be
accepted by a typical UNIX program from the shell.
The execv( ) function takes as argument the name of the file that holds the child's
code and the array of arguments.
Scheduling:
POSIX supports scheduling
Types
SCHED_FIFO – rate-monotonic scheduling
– strict priority-based scheduling scheme in which a
process runs until it is preempted or terminates.
minval = sched_get_priority_min(SCHED_RR);
maxval = sched_get_priority_max(SCHED_RR);
Shared Memory:
shm_open() – to open a shared memory
close() – close or erase a shared memory block
ftruncate() – to set the size of the shared memory
mmap() – to map the shared memory space in process memory space
munmap() – to unmap the memory when a process is done with the shared memory
pipe() – a parent process creates a pipe to talk to child process.
– it should be created before the creation of child process.
– returns an array of file descriptors
Message Queue:
Queue is similar to pipe but need not be created before the child process creation.
mq_open() – to create a named queue if doesn’t exist. If exist open the queue.
Mq_close – to close a queue.
WINDOWS CE
Supports smartphones, electronic instruments.
Windows CE is a 32-bit multitasking, multithreading operating system.
WINDOWS CE
WIN 32 APIs – manages access to the OS.
OAL – OEM Adaption Layer
– It facilitates communication between your operating system (OS) and your
target device and includes code to handle interrupts, timers, generic I/O control codes
WINDOWS CE
Windows CE supports 32 bit virtual address space.
Divided into Kernel space – 2GB and User space – 2GB
Threads are defined by executable files while drivers are defined by dynamically-
linked libraries (DLLs).
Execution is divided into time quanta. Each thread can have a separate quantum,
which can be changed using the API.
WINDOWS CE
Interrupt handling is divided among three entities:
Interrupt Service Handler (ISH) is a kernel service that provides the
first response to the interrupt.
The ISH selects an Interrupt Service Routine (ISR) to handle the
interrupt.
The ISR in turn calls an Interrupt Service Thread (IST) which
performs most of the work required to handle the interrupt.