0% found this document useful (0 votes)
22 views17 pages

Week3 ITE240 Process Management

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)
22 views17 pages

Week3 ITE240 Process Management

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/ 17

Chapter 2: Processes

Course Instructors: Dr. Lanka, Dr. Nay, Aj. Thinzar

Operating System Concepts – 9th Edition Silberschatz, Galvin and Gagne


Chapter 2: Processes
 Process Concept
 Process Scheduling
 Operations on Processes
 Interprocess Communication
 Examples of IPC Systems
 Communication in Client-Server Systems

Operating System Concepts – 9th Edition 3.2 Silberschatz, Galvin and Gagne
Objectives
 To introduce the notion of a process -- a program
in execution, which forms the basis of all
computation
 To describe the various features of processes,
including scheduling, creation and termination,
and communication
 To explore interprocess communication using
shared memory and message passing

Operating System Concepts – 9th Edition 3.3 Silberschatz, Galvin and Gagne
Multitasking in Mobile Systems
 Some mobile systems (e.g., early version of iOS)
allow only one process to run, others suspended
 Due to screen real estate, user interface limits iOS
provides for a
 Single foreground process- controlled via user
interface
 Multiple background processes– in memory,
running, but not on the display, and with limits
 Limits include single, short task, receiving
notification of events, specific long-running tasks
like audio playback
 Android runs foreground and background, with fewer
limits
 Background process uses a service to perform
tasks
 Service can keep running even if background
process is suspended
 Service has no user interface,
Operating System Concepts – 9th Edition 3.4
small memory useGalvin and Gagne
Silberschatz,
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 process via a context
switch
 Context of a process represented in the PCB
 Context-switch time is overhead; the system does
no useful work while switching
 The more complex the OS and the PCB  the
longer the context switch
 Time dependent on hardware support
 Some hardware provides multiple sets of
registers per CPU  multiple contexts loaded at
once

Operating System Concepts – 9th Edition 3.5 Silberschatz, Galvin and Gagne
Operations on Processes

 System must provide mechanisms for:


 process creation,
 process termination,
 and so on as detailed next

Operating System Concepts – 9th Edition 3.6 Silberschatz, Galvin and Gagne
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 options
 Parent and children share all resources
 Children share subset of parent’s resources
 Parent and child share no resources
 Execution options
 Parent and children execute concurrently
 Parent waits until children terminate

Operating System Concepts – 9th Edition 3.7 Silberschatz, Galvin and Gagne
A Tree of Processes

Operating System Concepts – 9th Edition 3.8 Silberschatz, Galvin and Gagne
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 fork() to replace
the process’ memory space with a new program

Operating System Concepts – 9th Edition 3.9 Silberschatz, Galvin and Gagne
C Program Forking Separate Process

Operating System Concepts – 9th Edition 3.10 Silberschatz, Galvin and Gagne
Process Termination

 Process executes last statement and then asks the


operating system to delete it using the exit()
system call.
 Returns status data from child to parent (via
wait())
 Process’ resources are deallocated by operating
system
 Parent may terminate the execution of children
processes using the abort() system call. Some
reasons for doing so:
 Child has exceeded allocated resources
 Task assigned to child is no longer required
 The parent is exiting and the operating systems
does not allow a child to continue if its parent
terminates

Operating System Concepts – 9th Edition 3.11 Silberschatz, Galvin and Gagne
Process Termination

 Some operating systems do not allow child to exists if


its parent has terminated. If a process terminates,
then all its children must also be terminated.
 cascading termination. All children, grandchildren,
etc. are terminated.
 The termination is initiated by the operating
system.
 The parent process may wait for termination of a child
process by using the wait()system call. The call
returns status information and the pid of the
terminated process
pid = wait(&status);
 If no parent waiting (did not invoke wait()) process is
a zombie
 If parent terminated without invoking wait , process
is an orphan

Operating System Concepts – 9th Edition 3.12 Silberschatz, Galvin and Gagne
Multiprocess Architecture – Chrome Browser

 Many web browsers ran as single process (some still


do)
 If one web site causes trouble, entire browser can
hang or crash
 Google Chrome Browser is multiprocess with 3
different types of processes:
 Browser process manages user interface, disk and
network I/O
 Renderer process renders web pages, deals with
HTML, Javascript. A new renderer created for each
website opened
 Runs in sandbox restricting disk and network I/O,
minimizing effect of security exploits
 Plug-in process for each type of plug-in

Operating System Concepts – 9th Edition 3.13 Silberschatz, Galvin and Gagne
Interprocess Communication
 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

Operating System Concepts – 9th Edition 3.14 Silberschatz, Galvin and Gagne
Communications Models
(a) Message passing. (b) shared memory.

Operating System Concepts – 9th Edition 3.15 Silberschatz, Galvin and Gagne
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
 Computation speed-up
 Modularity
 Convenience

Operating System Concepts – 9th Edition 3.16 Silberschatz, Galvin and Gagne
Producer-Consumer Problem
 Paradigm for cooperating processes, producer
process produces information that is consumed
by a consumer process
 unbounded-buffer places no practical limit on
the size of the buffer
 bounded-buffer assumes that there is a fixed
buffer size

Operating System Concepts – 9th Edition 3.17 Silberschatz, Galvin and Gagne

You might also like