0% found this document useful (0 votes)
42 views23 pages

M T M P: Ulti Asks and Ultiple Rocesses

This document discusses processes, threads, tasks, scheduling, and interprocess communication in operating systems. It covers topics like process states, scheduling policies like round robin and cyclostatic scheduling, priority-based scheduling algorithms like rate monotonic and earliest deadline first. It also discusses shared memory, message passing, and pipes for interprocess communication and standards like POSIX for portability across operating systems.

Uploaded by

JayakumarSankar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views23 pages

M T M P: Ulti Asks and Ultiple Rocesses

This document discusses processes, threads, tasks, scheduling, and interprocess communication in operating systems. It covers topics like process states, scheduling policies like round robin and cyclostatic scheduling, priority-based scheduling algorithms like rate monotonic and earliest deadline first. It also discusses shared memory, message passing, and pipes for interprocess communication and standards like POSIX for portability across operating systems.

Uploaded by

JayakumarSankar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23

MULTI TASKS AND MULTIPLE PROCESSES

1. Tasks and Processes:


 Process – Single execution of a program. Each process has multiple threads.
 Thread – Processes that share the same address space
 Task – Independent thread of execution.

2. Timing Requirements on Processes:


 Release Time – the time at which a process becomes ready to execute.
 Deadline – time at which a computation is finished.
 Task Graph – Task – Task set

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

4. Scheduling and Switching Policies:


 Scheduling - the process of choosing the order of running processes.
 Scheduling states – 3 – Waiting, Ready and Executing
 Hyperperiod – the least common multiple of the period of all the processes.

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

Preemptive Real Time Operating Systems:


1. Preemptive:
 Preemptive is a way to control execution.
 Kernel – a part of OS that determines what process to run.
 Timer – used to periodically activate the kernel.
 Assembly language is used to save and restore register that define process.
 Context – set of register that define a process.
 Context Switching – Switching from one process register to another.
PREEMPTIVE REAL TIME OPERATING SYSTEMS:
PRIORITY BASED SCHEDULING
2. Priorities:
 The kernel chooses which process to be executed based on the priority list.
 Usually priority is allocated based on execution time.
 2 types
 Static Priorities – Priority don’t change during execution
 Dynamic Priorities - Priority changes during execution
1. Rate Monotonic Scheduling:
 Example of Static Scheduling
 Features
PRIORITY BASED SCHEDULING
 Example:

 Feasible Assignment of Priority


 2 processes – Period - ; Computation Time – T1 & T2

Priority – P1 Priority – P2
PRIORITY BASED SCHEDULING
2. Earliest Deadline First Scheduling:
 EDF assigns priorities in order of deadline.

 The highest-priority process is the one whose deadline is nearest in time,


and the lowest priority process is the one whose deadline is farthest away.

 Priorities will be recalculated at every completion of a process.

 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.

Fixed Program Execution Time:


 The program execution time depends on the behavior and caching effect.

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.

childid == fork(); else


if (childid == 0) {
{ /* is the parent */
/* must be the child */ parent_stuff(); /* execute parent
execv (“mychild",childargs); functionality */
perror(“execl”); wait(&cstatus);
exit(1); exit(0);
} }
POSIX
 The execv() function doesn’t return automatically.
 The perror () and exit() are used to stop the child function.
 The parent has to use a wait function before exit function in order to get the child id.

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.

 SCHED_RR – combination of real-time and interactive scheduling


techniques
– the processes are timesliced

 Different process can run with different scheduling policy.

 The sched_setscheduler( ) function that allows a process to set a scheduling policy.


POSIX
 The minimum and maximum priority of a process can be allocated by the following
functions.

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

 The use space is again divided into two 1GB.


 Top 1GB - DLLs, memory mapped files, and shared system heap
 Bottom 1GB - holds user elements such as code, data, stack, and heap.
 WinCE supports two kernel-level units of execution
WINDOWS CE
 WinCE supports two kernel-level units of execution.
 Threads
 Drivers

 Threads are defined by executable files while drivers are defined by dynamically-
linked libraries (DLLs).

 A process can run multiple threads.

 Each thread is assigned an integer priority.


 0 is the highest priority and 255 is the lowest possible priority.

 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.

You might also like