operating system process management
TRANSCRIPT
-
7/30/2019 Operating system Process Management
1/91
Chapter 2: Process Management
2. Process Management
-
7/30/2019 Operating system Process Management
2/91
Process Management
2.1 Process Concept
2.2 Process Control Block
2.3 Process operations :
Create
Kill
suspend
resume
wakeup,
2.4 Interprocess Communication IPC types
2.5 IPC in Client-Server RTOS (Real Time Operating System)
2. Process Management
-
7/30/2019 Operating system Process Management
3/91
Process Concept An operating system executes a variety of programs:
Batch system jobs Time-shared systems user programs or tasks
Textbook uses the termsjob andprocess almost
interchangeably
Process
a program in execution; A process includes:
Heap: Dynamic Storage allocation.
program counter :Next instruction to execute
Stack: Temporary data( Function, Parameters, localvariables)
data sect (Global variable)
Text: Process is more than program code which called
as text 2. Process Management
-
7/30/2019 Operating system Process Management
4/91
Process in Memory
2. Process Management
-
7/30/2019 Operating system Process Management
5/91
Diagram of Process State
2. Process Management
http://localhost/var/www/apps/conversion/tmp/scratch_5/OS%20SWF%20Final%2010%20Dec%202012/Chapter%202%20Process%20Management/Dynamic%20State%20of%20Process.htmhttp://localhost/var/www/apps/conversion/tmp/scratch_5/OS%20SWF%20Final%2010%20Dec%202012/Chapter%202%20Process%20Management/Dynamic%20State%20of%20Process.htm -
7/30/2019 Operating system Process Management
6/91
Process State
As a process executes, it changes state
New: The process is being created
Ready: The process is waiting to be assigned to a processor
Running: Instructions are being executed
Waiting: The process is waiting for some event to occur
Terminated: The process has finished execution At one time only one process can be runnning on a single
processor
2. Process Management
-
7/30/2019 Operating system Process Management
7/91
The dynamic state of a process.
Example process life cycle PROCESS
2. Process Management
http://localhost/var/www/apps/conversion/tmp/scratch_5/OS%20SWF%20Final%2010%20Dec%202012/Chapter%202%20Process%20Management/Dynamic%20State%20of%20Process.htmhttp://f/swf/Example%20process%20life%20cycle%20PROCESS.SWFhttp://f/swf/Example%20process%20life%20cycle%20PROCESS.SWFhttp://f/swf/Example%20process%20life%20cycle%20PROCESS.SWFhttp://f/swf/Example%20process%20life%20cycle%20PROCESS.SWFhttp://localhost/var/www/apps/conversion/tmp/scratch_5/OS%20SWF%20Final%2010%20Dec%202012/Chapter%202%20Process%20Management/Dynamic%20State%20of%20Process.htm -
7/30/2019 Operating system Process Management
8/91
Five-State Process Model
2. Process Management
-
7/30/2019 Operating system Process Management
9/91
Process Scheduling Queues
A. Job queue set of all processes in the system
B. Ready queue set of all processes residing in main
memory, ready and waiting to execute
C. Device queues set of processes waiting for an I/O
device
Processes migrate among the various queues
-
7/30/2019 Operating system Process Management
10/91
Ready Queue And
Various I/O Device Queues
-
7/30/2019 Operating system Process Management
11/91
Representation of Process Scheduling
-
7/30/2019 Operating system Process Management
12/91
Schedulers
Long-term scheduler (or job scheduler) selects which processesshould be brought into the ready queue
Short-term scheduler (or CPU scheduler) selects which process
should be executed next and allocates CPU
-
7/30/2019 Operating system Process Management
13/91
Addition of Medium Term Scheduling
-
7/30/2019 Operating system Process Management
14/91
Addition of Medium Term Scheduling
Execute
Wait for i/o
Suspend
-
7/30/2019 Operating system Process Management
15/91
Frequency of calling Schedulers (Cont.) Short-term scheduler is invoked very frequently (milliseconds)
(must be fast)
Long-term scheduler is invoked very infrequently (seconds, minutes)
(may be slow)
The long-term scheduler controls the degree of multiprogramming
Processes can be described as either:
I/O-bound process spends more time doing I/O than
computations, many short CPU bursts
CPU-bound process spends more time doing computations;
few very long CPU bursts
-
7/30/2019 Operating system Process Management
16/91
Context Switch When CPU switches to another process, the system must save the
state of the old process and load the saved state for the new processvia a context switch
Contextof a process represented in the PCB
Context-switch time is overhead; the system does no useful work
while switching
Time dependent on hardware support
http://localhost/var/www/apps/conversion/tmp/scratch_5/OS%20SWF%20Final%2010%20Dec%202012/Chapter%202%20Process%20Management/CPU%20switching%20between%20processes%20as%20a%20result%20of%20system%20calls%20or%20interrupts.htmhttp://localhost/var/www/apps/conversion/tmp/scratch_5/OS%20SWF%20Final%2010%20Dec%202012/Chapter%202%20Process%20Management/CPU%20switching%20between%20processes%20as%20a%20result%20of%20system%20calls%20or%20interrupts.htm -
7/30/2019 Operating system Process Management
17/91
CPU Switch From Process to Process
http://localhost/var/www/apps/conversion/tmp/scratch_5/OS%20SWF%20Final%2010%20Dec%202012/Chapter%202%20Process%20Management/CPU%20switching%20between%20processes%20as%20a%20result%20of%20system%20calls%20or%20interrupts.htmhttp://localhost/var/www/apps/conversion/tmp/scratch_5/OS%20SWF%20Final%2010%20Dec%202012/Chapter%202%20Process%20Management/CPU%20switching%20between%20processes%20as%20a%20result%20of%20system%20calls%20or%20interrupts.htm -
7/30/2019 Operating system Process Management
18/91
Process Control Block
Identifier
Figure 3.1 Simplified Process Control Block
State
Priority
Program counter
Memory pointers
Context data
I/O status
information
Accounting
information
2. Process Management
-
7/30/2019 Operating system Process Management
19/91
Process Control Block (PCB)
Information associated with each process
Process state: New, Ready, Running waiting
Program counter: Address of next instruction to execute
CPU registers: accumulators, index registers, stack pointers and general
purpose register plus condition code information. In case of interrupt
Process start continuously correct from last state
CPU scheduling information: Process priority pointers to scheduling
queues and any other scheduling information
Memory-management information: value of base and limit registers,
page table or segment table.
Accounting information:CPUusedtime, used time limit, accountnumbers, job or process numbers and so on.
I/O status information: list of I/O devices allocated to the processes, a
list of open files and so on.
Process Management 2. Process Management
-
7/30/2019 Operating system Process Management
20/91
Process Scheduling Queues
Job queue set of all processes in the system
Ready queue set of all processes residing in main memory, ready
and waiting to execute
Device queues set of processes waiting for an I/O device
Processes migrate among the various queues
2. Process Management
-
7/30/2019 Operating system Process Management
21/91
Ready Queue And
Various I/O Device Queues
2. Process Management
-
7/30/2019 Operating system Process Management
22/91
Representation of Process Scheduling
2. Process Management
-
7/30/2019 Operating system Process Management
23/91
Process Operations
Process operations :
Create(New)
Kill(Terminate)
Suspend(When blocked process swapped out from main memory)
resume: Restart from previous wait state wakeup: Give signal that process has to make alive which is stopped
previously(Notify and Notify all)
2. Process Management
-
7/30/2019 Operating system Process Management
24/91
Process Creation
Parent process create children processes, which, in turn create other
processes, forming a tree of processes
Generally, process identified and managed via a process identifier (pid)
Resource sharing Parent and children share all resources
Children share subset of parents resources
Parent and child share no resources(directly taking from o.s.)
Restricting a child process to a subset of the parentsresources
Execution
Parent and children execute concurrently
Parent waits until children terminate
2. Process Management
-
7/30/2019 Operating system Process Management
25/91
A tree of processes on a typical Solaris
2. Process Management
Pageout and flsflush: Memory
Management
Init: Parent process for all child
processinetdand : Networking
services such as t e l n e t and
ftp;
Dtlogin:login screen.
Xsession :- Creating usersession
sdt_shel : command-line shell
the C-shell or commandline
Interface invokes various child
processes, such as theI s and cat commands.
-
7/30/2019 Operating system Process Management
26/91
Process Creation (Cont.)
Address space
Child duplicate of parent
Child has a program loaded into it
UNIX examples
fork system call creates new process
exec system call used after a forkto replace the process memory
space with a new program
2. Process Management
-
7/30/2019 Operating system Process Management
27/91
Process Creation
2. Process Management
Fork(): Create new process parent/child
Return value: Null to child and return pid ofchild to parent
Exec () : system call loads a binary file into
memory and starts its execution.
Wait(): parent calls wait if it has not any
operation and wait for child to terminate
When the child process completes
the parent process resumes from the call to
wait (),
e x i t () :completes using the system call.
-
7/30/2019 Operating system Process Management
28/91
C Program Forking Separate Process
int main()
{pid_t pid;
/* fork another process */
pid = fork();
if (pid < 0) { /* error occurred */
fprintf(stderr, "Fork Failed");
exit(-1);
}
else if (pid == 0) { /* child process */execlp("/bin/ls", "ls", NULL);
}
else { /* parent process */
/* parent will wait for the child to complete */
wait (NULL);
printf ("Child Complete");
exit(0);}
}
2. Process Management
-
7/30/2019 Operating system Process Management
29/91
Process Creation in Java
2. Process Management
-
7/30/2019 Operating system Process Management
30/91
Kill(Process Termination) Process executes last statement and asks the operating system to
delete it
Unix: exit()
TerminateProcess() in Win32
Output data from child to parent (via wait)
Process resources are deallocated by operating system
Only Parent may terminate execution of children processes (abort)
Child has exceeded allocated resources
Task assigned to child is no longer required
If parent is exiting
Some operating system do not allow child to continue if its
parent terminates
All children terminated - cascading termination(Defining
on delete cascade)2. Process Management
-
7/30/2019 Operating system Process Management
31/91
2. Process Management
If parent terminates child how child will resume further:
The wait () system call returns the process identifier of a terminated child
Assigned as new parent to terminate process defined in the init process.
Thus, the children still have a parent to collect their status and execution
statistics
-
7/30/2019 Operating system Process Management
32/91
Process Termination
2. Process Management
Read only
O.S. Area
-
7/30/2019 Operating system Process Management
33/91
Process Termination
2. Process Management
Not responding End now
User Mode and kernel mode
Cursoponding
s/w not available
-
7/30/2019 Operating system Process Management
34/91
Suspended Processes
Swap processes to disk to free up more memory
Blocked or Wait state becomes suspend state when swapped to disk
again Activating into ready state and go on,
Two new states
Blocked/Suspend
Ready/Suspend
2. Process Management
-
7/30/2019 Operating system Process Management
35/91
Ready-suspendedfor those suspended process whose restarting conditionhas occurred.
Blocked-suspendedfor those who must still wait instead.
2. Process Management
-
7/30/2019 Operating system Process Management
36/91
Reasons for Process Suspension
2. Process Management
If resource unavailable
Alarm ,Burst time
-
7/30/2019 Operating system Process Management
37/91
Suspending, Resuming, and Stopping Threads
Display the time of day. If the user doesnt want a clock, then its thread
can be suspended. Once suspended, restarting the thread is also a simple
matter.
2. Process Management
-
7/30/2019 Operating system Process Management
38/91
Resume, Wakeup
wait( ) tells the calling thread to give up the monitor and go to sleep
by giving sleeep() until some other process enters the same monitor
and calls notify( ).
notify( ) wakes up the first process that called wait( ) on the same
object.
notifyAll( ) wakes up all the processes that called wait( ) on the same
object.
Notifications affect only threads that have been waiting ahead of the
notification
The highest priority process will run first.
2. Process Management
-
7/30/2019 Operating system Process Management
39/91
2. Process Management
The run( ) method contains a block thatchecks suspendFlag.
IfsuspendFlag. is true, the wait( )
method is invoked to suspend the
execution of the process.
sets suspendFlag to false and invokes
notify( ) to wake up the thread.Sleep() : Pausing Execution with Sleep()
Thread.sleep causes the current thread
to suspend execution for a specified
period
Suspend(): causes any execution to be
suspend
-
7/30/2019 Operating system Process Management
40/91
2. Process Management
The notification methods :(Telling wait process to
resume operation) notify(): and notifyAll()notifyAll(): wake up all waitin process
notify() : picks one of the waiting process wakes up.
( )
-
7/30/2019 Operating system Process Management
41/91
Interprocess Communication(IPC)
Processes within a system may be independent or cooperating
Cooperating process can affect or be affected by other processes,including sharing data
Reasons for cooperating processes:
Information sharing
Computation speedup
Modularity
Convenience
Cooperating processes need interprocess communication (IPC)
Two models of IPC
Shared Memory
Message Passing System
2. Process Management
C i
-
7/30/2019 Operating system Process Management
42/91
Cooperating Processes
Independent process cannot affect or be affected by the execution of
another process.
Cooperating process can affect or be affected by the execution of another
process.
Advantages of process cooperation
Information sharing (share resource)
Computation speed-up: Process divide into sub -processes(pipelining)
Modularity(Problem in one sub process will not or less affect on the
processes) Convenience( User can perform more than one operations open file,
edit file, print file, Check grammar)
2. Process Management
-
7/30/2019 Operating system Process Management
43/91
Communications Models
A:Message Passing
B: Shared Memory2. Process Management
Sh d M i J
-
7/30/2019 Operating system Process Management
44/91
Shared Memory in Java
2. Process Management
Shared memory approach
-
7/30/2019 Operating system Process Management
45/91
Shared memory approachProducer-Consumer Problem
Allow producer and consumer processes to run concurrently Paradigm for cooperating processes,producerprocess produces
information that is consumed by a consumerprocess
The producer and consumer must be synchronized,
unbounded-bufferplaces no practical limit on the size of the
buffer
bounded-bufferassumes that there is a fixed buffer size
2. Process Management
-
7/30/2019 Operating system Process Management
46/91
Bounded-Buffer Shared-Memory Solution
Shared data
#define BUFFER_SIZE 10
typedef struct {
. . .
} item;
item buffer[BUFFER_SIZE];
int in = 0;
int out = 0;
Solution is correct, but can only use BUFFER_SIZE-1 elements
2. Process Management
B d d B ff P d
-
7/30/2019 Operating system Process Management
47/91
Bounded-Buffer Producer
The buffer is full when ((in + 1) % BUFFER_SIZE) == out.
while (true) {/* Produce an item */
while (((in = (in + 1) % BUFFER SIZE count) == out)
; /* do nothing -- no free buffers */
buffer[in] = item;
in = (in + 1) % BUFFER SIZE;}
Throuout: Out=0
First in=0
Last before in=8
Last in=9 which makes condition false so no add item in buffer
2. Process Management
-
7/30/2019 Operating system Process Management
48/91
Bounded Buffer ConsumerThe buffer is empty when in == out;
while (true) {while (in == out)
; // do nothing -- nothing to consume
// remove an item from the bufferitem = buffer[out];
out = (out + 1) % BUFFER SIZE;
return item;
}
Throuout: Out=9
First out=0
Last before out=8
Last out=9 which makes condition false so no
retreival of items.2. Process Management
-
7/30/2019 Operating system Process Management
49/91
Interprocess Communication Message Passing Without sharing address space provide Mechanism for processes to
communicate and to synchronize their actions
Message system processes communicate with each other without resortingto shared variables
IPC facility provides two operations:
send(message) message size fixed or variable
receive(message)
IfP and Q wish to communicate, they need to:
establish a communicationlinkbetween them
exchange messages via send/receive
Implementation of communication link
physical (e.g., shared memory, hardware bus)
logical (e.g., logical properties)
Direct communication Indirect Communication
Synchronization
Buffering
2. Process Management
I l t ti Q ti
-
7/30/2019 Operating system Process Management
50/91
Implementation Questions
How are links established?
Can a link be associated with more than two processes?
How many links can there be between every pair of communicating
processes?
What is the capacity of a link?
Is the size of a message that the link can accommodate fixed or variable?
Is a link unidirectional or bi-directional?
2. Process Management
Di t C i ti
-
7/30/2019 Operating system Process Management
51/91
Direct Communication Symmetric direct communication:both the senderprocess and the receiver
process must name the other to communicate.
Processes must name each other explicitly: send (P, message) send a message to process P(P Is receiver)
receive(Q, message) receive a message from process Q(Q is sender)
ASymmetric direct communication: only the sender names the recipient; the
recipient is not required to name the sender
send(P, message)Send a message to process P. receive(id, message)-Receive a message from any process; the variable
Properties of communication link
Links are established automatically
A link is associated with exactly one pair of communicating processes
Between each pair there exists exactly one link The link may be unidirectional, but is usually bi-directional
Disavantage: In general, any such hard-coding techniques, where identifiers must
be explicitly stated, are less desirable than techniques involving
indirection, as described next.(indirect communication)
2. Process Management
Indirect Communication
-
7/30/2019 Operating system Process Management
52/91
Indirect Communication
Instead of sending message to receiver send message to mailbox
Messages are directed and received from mailboxes (also referredto as ports)
Each mailbox has a unique id
Processes can communicate only if they share a mailbox
Properties of communication link Link established only if processes share a common mailbox
A link may be associated with many processes
Each pair of processes may share several communication links
Link may be unidirectional or bi-directional
2. Process Management
Indirect Communication
-
7/30/2019 Operating system Process Management
53/91
Indirect Communication
Operations
create a new mailbox
send and receive messages through mailbox
destroy a mailbox
Primitives are defined as:
send(A, message) send a message to mailbox A
receive(A, message) receive a message from mailbox A
2. Process Management
Indirect Communication
-
7/30/2019 Operating system Process Management
54/91
Indirect Communication
Mailbox sharing
P1, P2, and P3 share mailbox A
P1, sends; P2and P3 receive
Who gets the message?
Solutions
Allow a link to be associated with at most two processes
Allow only one process at a time to execute a receive operation
Allow the system to select arbitrarily the receiver. Sender is notified
who the receiver was.
2. Process Management
-
7/30/2019 Operating system Process Management
55/91
2. Process Management
Mailbox ownership
Process:
When a process that owns a mailbox terminates, the mailbox disappearsOperating system:
Mailbox is independent and not atttahced to partiular proces.
Steps for message passing
Initially, the owneris the only process that can receive messages through
this mailbox. However, the ownership and receiving privilege may bepassed to other processes through appropriate system calls. Of course,
this provision
could result in multiple receivers for each mailbox.
-
7/30/2019 Operating system Process Management
56/91
Synchronization Message passing may be either blocking or non-blocking
Blocking is considered synchronous
Blocking send has the sender block until the message is received
Blocking receive has the receiver block until a message is
available
Non-blocking is considered asynchronous
Non-blocking send has the sender send the message and
continue
Non-blocking receive has the receiver receive a valid message or
null
2. Process Management
-
7/30/2019 Operating system Process Management
57/91
Buffering Queue of messages attached to the link; implemented in one
of three ways1. Zero capacity 0 messages
Sender must wait for receiver (rendezvous)
2. Bounded capacity finite length ofn messages Sender
must wait if link full
3. Unbounded capacity infinite lengthSender never waits
2. Process Management
Process Management
Local Proced re Calls in Windo s XP
-
7/30/2019 Operating system Process Management
58/91
Local Procedure Calls in Windows XP
2. Process Management
Process Management
Communications in Client Server Systems
-
7/30/2019 Operating system Process Management
59/91
Communications in Client-Server Systems
Sockets
Remote Procedure Calls
Remote Method Invocation (Java)
2. Process Management
Sockets
-
7/30/2019 Operating system Process Management
60/91
Sockets
A socket is defined as an endpoint for communication
Concatenation of IP address and port
The socket 161.25.19.8:1625 refers to port 1625 on host
161.25.19.8
Communication consists between a pair of sockets
2. Process Management
-
7/30/2019 Operating system Process Management
61/91
Socket Communication
2. Process Management
-
7/30/2019 Operating system Process Management
62/91
2. Process Management
-
7/30/2019 Operating system Process Management
63/91
2. Process Management
-
7/30/2019 Operating system Process Management
64/91
2. Process Management
Socket Communication in Java
-
7/30/2019 Operating system Process Management
65/91
Socket Communication in Java
2. Process Management
Socket Communication in Java
-
7/30/2019 Operating system Process Management
66/91
Socket Communication in Java
2. Process Management
-
7/30/2019 Operating system Process Management
67/91
Remote Procedure Calls
Remote procedure call (RPC) abstracts procedure calls between processeson networked systems
Stubs client-side proxy for the actual procedure on the server
The client-side stub locates the server and marshalls the parameters
The server-side stub receives this message, unpacks the marshalled
parameters, and peforms the procedure on the server
2. Process Management
-
7/30/2019 Operating system Process Management
68/91
Execution of RPC
2. Process Management
-
7/30/2019 Operating system Process Management
69/91
Remote Method Invocation Remote Method Invocation (RMI) is a Java mechanism similar to RPCs
RMI allows a Java program on one machine to invoke a method on aremote object
2. Process Management
-
7/30/2019 Operating system Process Management
70/91
2. Process Management
-
7/30/2019 Operating system Process Management
71/91
2. Process Management
MatchmakeRequested
Procedure
-
7/30/2019 Operating system Process Management
72/91
Socket flow of events -- synchronous
Await client message
Receive client messageDecode client message (Unmarshaling)
Perform action
Create client message
Send to client
Get user input
Decode user input(Marshaling)
Create server message
Send message to server
Await server response
Receive server message
Decode reply
Send output to user
Client Server
Method call on standalone object
-
7/30/2019 Operating system Process Management
73/91
Socket flow - asynchronous
Wait
Receive client msgDecode client msg
Perform action
Create client message
Send to client1
Send to client2
User input (UI)
Decode UI
Create srvr msg
Send srvr msgAwait srvr reply
Receive server
messageDecode reply
Output to user
Client1 Server
User input (UI)
Decode UI
Create srvr msg
Send srvr msgAwait srvr reply
Receive server
messageDecode reply
Output to user
Client2
-
7/30/2019 Operating system Process Management
74/91
RMI Example
Stub is generated which then sends marshalled data to receiver
x = remoteObj.MethodA(param); Remote Object
Stub
Remote Reference Layer
Transport Layer
Receiver
2. Process Management
-
7/30/2019 Operating system Process Management
75/91
RMI Example
Receiver unmarshals, or decodes, parameters, locatesobject and calls the method specified by the stub
x = remoteObj.MethodA(param); Remote Object
Stub
Remote Reference Layer
Transport Layer
Receiver
2. Process Management
-
7/30/2019 Operating system Process Management
76/91
RMI Example
Receiver retrieves and marshals return value and sendsback the encoded info to the stub
x = remoteObj.MethodA(param); Remote Object
Stub
Remote Reference Layer
Transport Layer
Receiver
2. Process Management
-
7/30/2019 Operating system Process Management
77/91
Marshalling Parameters
2. Process Management
RMI Example
-
7/30/2019 Operating system Process Management
78/91
RMI Example
2. Process Management
RMI Example
-
7/30/2019 Operating system Process Management
79/91
RMI Example
2. Process Management
RMI Example
-
7/30/2019 Operating system Process Management
80/91
a p e
2. Process Management
Chapter Index: 2 Process Management
-
7/30/2019 Operating system Process Management
81/91
2. Process Management
Pi
-
7/30/2019 Operating system Process Management
82/91
Pipes
Pipes: Pipes are used to allow one or more processes to have informationflow between
2. Process Management
-
7/30/2019 Operating system Process Management
83/91
Reading from pipesread() will return 0 (end of file) when the write end of the pipe is closed. if
write end of the is still open and there is no data, read() will sleep until
input become available.
if a read() tries to get more data than is currently in pipe, read() will only
contain the number of bytes actually read. Subsequent reads will sleepuntil more data is available.
Writing to pipes
When writing to a pipe:
If read end of pipe is closes, a write() will fail and process will be sent
SIGPIPE signal. Default SIGPIPE handler terminates.
2. Process Management
-
7/30/2019 Operating system Process Management
84/91
There are 2 types of pipes:unnamed pipesnamed pipes
Unnamed/Anonymous pipes:They are created, used and destroyed within thelife a set of processes. Each end of the pipe has its own file descriptor. Oneend is for reading and one end is for writing. When you are done with a pipe,it is closed like any other file.
#include int pipe(int fd[2]);Returns 2 file descriptors in the fd array.fd[0] is for readfd[1] write
Returns 0 on successful creation of pipe, 1 otherwise.Each end of the pipe is closed individually using normal close() system call.Pipes are only available the process that creates the pipe and its descendants.
2. Process Management
-
7/30/2019 Operating system Process Management
85/91
Named pipesNamed pipes are also called FIFOs (first in first out). They have names
and exist as special files within a file system. (file type p) They exist until
they are removed with rm or unlink()
They can be used with unrelated process not just descendants of the pipe
creator. i.e. accessing by process from outside of pipe Created with:
mknod utility
mknod() system call
2. Process Management
-
7/30/2019 Operating system Process Management
86/91
Reading from pipes
When reading from a pipe:
read() will return 0 (end of file) when the write end of the pipe is closed. if
write end of the is still open and there is no data, read() will sleep until
input become available. if a read() tries to get more data than is currentlyin pipe, read() will only contain the number of bytes actually read.
Subsequent reads will sleep until more data is available.
Writing to pipes
When writing to a pipe:
If read end of pipe is closes, a write() will fail and process will be sent
SIGPIPE signal. Default SIGPIPE handler terminates.
2. Process Management
T f P
-
7/30/2019 Operating system Process Management
87/91
Trace of Processes
2. Process Management
P St t
-
7/30/2019 Operating system Process Management
88/91
Process States
Process Management
2. Process Management
-
7/30/2019 Operating system Process Management
89/91
2. Process Management
RTOS
-
7/30/2019 Operating system Process Management
90/91
RTOS
2. Process Management
Real-time operating system 1
Real-time operating system
A real-time operating system (RTOS) is an operating system (OS)
intended to serve real-time application requests.
It must be able to process data as it comes in, typically without
buffering delays.
jitter.: amount of time it takes to accept and complete an application's
task;
A hard real-time operating system has less jitter than a
softreal-time operating system.
minimal interrupt latency and minimal thread switching latency;
a real-time OS is valued more for how quickly or how predictably it
can respond than for the amount of work it can perform in a givenperiod of time.[3]
-
7/30/2019 Operating system Process Management
91/91