SlideShare ist ein Scribd-Unternehmen logo
1 von 23
3.1 Silberschatz, Galvin and GagneOperating System Concepts – 8th
Edition
Process
An operating system executes a variety of programs:
Batch system – jobs
Time-shared systems – user programs or tasks
Process – a program in execution; process execution must
progress in sequential fashion
A process includes:
program counter
stack
data section
Topics:
Operations in Process
Scheduling
Interprocess Communication
3.2 Silberschatz, Galvin and GagneOperating System Concepts – 8th
Edition
Process in Memory
3.3 Silberschatz, Galvin and GagneOperating System Concepts – 8th
Edition
Process State
As a process executes, it changes state
new: The process is being created
running: Instructions are being executed
waiting: The process is waiting for some
event to occur
ready: The process is waiting to be assigned
to a processor
terminated: The process has finished
execution
3.4 Silberschatz, Galvin and GagneOperating System Concepts – 8th
Edition
Process States and Transition
3.5 Silberschatz, Galvin and GagneOperating System Concepts – 8th
Edition
Process Control Block (PCB)
3.6 Silberschatz, Galvin and GagneOperating System Concepts – 8th
Edition
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
Time dependent on hardware support
3.7 Silberschatz, Galvin and GagneOperating System Concepts – 8th
Edition
CPU Switch From Process to Process
3.8 Silberschatz, Galvin and GagneOperating System Concepts – 8th
Edition
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)
Options in Resource sharing
Parent and children share all resources
Children share subset of parent’s resources
Parent and child share no resources
Options Execution
Parent and children execute concurrently
Parent waits until children terminate
3.9 Silberschatz, Galvin and GagneOperating System Concepts – 8th
Edition
Process Creation (Cont.)
Options n 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
3.10 Silberschatz, Galvin and GagneOperating System Concepts – 8th
Edition
Unix Fork/Exec/Exit/Wait Example
int pid = fork();
Create a new process that is a
clone of its parent.
exec*(“program” [, argvp, envp]);
Overlay the calling process
virtual memory with a new
program, and transfer control
to it.
exit(status);
Exit with status, destroying the
process.
int pid = wait*(&status);
Wait for exit (or other status
change) of a child.
fork parent fork child
wait exit
exec
initialize
child
context
3.11 Silberschatz, Galvin and GagneOperating System Concepts – 8th
Edition
Example: Process Creation in Unix
int pid;
int status = 0;
if (pid = fork()) {
/* parent */
…..
pid = wait(&status);
} else {
/* child */
…..
exit(status);
}
Parent uses wait to sleep
until the child exits; wait
returns child pid and
status.
Wait variants allow wait
on a specific child, or
notification of stops and
other signals.
The fork syscall
returns twice: it
returns a zero to the
child and the child
process ID (pid) to the
parent.
3.12 Silberschatz, Galvin and GagneOperating System Concepts – 8th
Edition
C Program Forking Separate Process
int main()
{
int 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);
}
}
3.14 Silberschatz, Galvin and GagneOperating System Concepts – 8th
Edition
Process Termination
Process executes last statement and asks the operating system to
delete it (exit)
Output data from child to parent (via wait)
Process’ resources are deallocated by operating system
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
3.15 Silberschatz, Galvin and GagneOperating System Concepts – 8th
Edition
Communications Models: Shared
memory or Message Passing
3.16 Silberschatz, Galvin and GagneOperating System Concepts – 8th
Edition
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
3.17 Silberschatz, Galvin and GagneOperating System Concepts – 8th
Edition
Motivation for multi-threaded servers
3.18 Silberschatz, Galvin and GagneOperating System Concepts – 8th
Edition
Single and Multithreaded Processes
3.19 Silberschatz, Galvin and GagneOperating System Concepts – 8th
Edition
Benefits
Responsiveness
Resource Sharing
Economy
Scalability
3.20 Silberschatz, Galvin and GagneOperating System Concepts – 8th
Edition
Kernel Threads
Recognized and supported by the OS Kernel
OS explicitly performs scheduling and context switching of kernel threads
Examples
Windows XP/2000
Solaris
Linux
Tru64 UNIX
Mac OS X
3.21 Silberschatz, Galvin and GagneOperating System Concepts – 8th
Edition
User Threads
Thread management done by user-level threads library
OS kernel does not know/recognize there are multiple threads running
in a user program.
The user program (library) is responsible for scheduling and context
switching of its threads.
Three primary thread libraries:
POSIX Pthreads
Win32 threads
Java threads
3.22 Silberschatz, Galvin and GagneOperating System Concepts – 8th
Edition
User- vs. Kernel-level Threads
From W. Stallings, Operating Systems, 6th
Edition
3.23 Silberschatz, Galvin and GagneOperating System Concepts – 8th
Edition
Pthreads
May be provided either as user-level or kernel-level
A POSIX standard (IEEE 1003.1c) API for thread creation and
synchronization
API specifies behavior of the thread library, implementation is up to
development of the library
Common in UNIX operating systems (Solaris, Linux, Mac OS X)
3.24 Silberschatz, Galvin and GagneOperating System Concepts – 8th
Edition
Java Threads
Java threads are managed by the JVM
Typically implemented using the threads model provided by
underlying OS
Java threads may be created by:
Extending Thread class
Implementing the Runnable interface

Weitere ähnliche Inhalte

Was ist angesagt?

Load Balancing In Distributed Computing
Load Balancing In Distributed ComputingLoad Balancing In Distributed Computing
Load Balancing In Distributed ComputingRicha Singh
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategiesDr. Loganathan R
 
Multithreading
MultithreadingMultithreading
MultithreadingA B Shinde
 
Distributed DBMS - Unit 8 - Distributed Transaction Management & Concurrency ...
Distributed DBMS - Unit 8 - Distributed Transaction Management & Concurrency ...Distributed DBMS - Unit 8 - Distributed Transaction Management & Concurrency ...
Distributed DBMS - Unit 8 - Distributed Transaction Management & Concurrency ...Gyanmanjari Institute Of Technology
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed SystemsPritom Saha Akash
 
Introduction to Operating Systems
Introduction to Operating SystemsIntroduction to Operating Systems
Introduction to Operating SystemsMukesh Chinta
 
Evolution of operating system
Evolution of operating systemEvolution of operating system
Evolution of operating systemArshad khan
 
Linux process management
Linux process managementLinux process management
Linux process managementRaghu nath
 
Introduction to Operating Systems
Introduction to Operating SystemsIntroduction to Operating Systems
Introduction to Operating SystemsShweta Shah
 
Chapter 6 - Process Synchronization
Chapter 6 - Process SynchronizationChapter 6 - Process Synchronization
Chapter 6 - Process SynchronizationWayne Jones Jnr
 
Chapter 1: Introduction to Operating System
Chapter 1: Introduction to Operating SystemChapter 1: Introduction to Operating System
Chapter 1: Introduction to Operating SystemShafaan Khaliq Bhatti
 

Was ist angesagt? (20)

Load Balancing In Distributed Computing
Load Balancing In Distributed ComputingLoad Balancing In Distributed Computing
Load Balancing In Distributed Computing
 
Threads .ppt
Threads .pptThreads .ppt
Threads .ppt
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategies
 
Multithreading
MultithreadingMultithreading
Multithreading
 
Distributed DBMS - Unit 8 - Distributed Transaction Management & Concurrency ...
Distributed DBMS - Unit 8 - Distributed Transaction Management & Concurrency ...Distributed DBMS - Unit 8 - Distributed Transaction Management & Concurrency ...
Distributed DBMS - Unit 8 - Distributed Transaction Management & Concurrency ...
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed Systems
 
Lecture 3 threads
Lecture 3   threadsLecture 3   threads
Lecture 3 threads
 
Distributed Operating System_1
Distributed Operating System_1Distributed Operating System_1
Distributed Operating System_1
 
Process of operating system
Process of operating systemProcess of operating system
Process of operating system
 
Introduction to Operating Systems
Introduction to Operating SystemsIntroduction to Operating Systems
Introduction to Operating Systems
 
Evolution of operating system
Evolution of operating systemEvolution of operating system
Evolution of operating system
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
Mainframe systems
Mainframe systemsMainframe systems
Mainframe systems
 
Paging and segmentation
Paging and segmentationPaging and segmentation
Paging and segmentation
 
Linux process management
Linux process managementLinux process management
Linux process management
 
Introduction to Operating Systems
Introduction to Operating SystemsIntroduction to Operating Systems
Introduction to Operating Systems
 
Ch1-Operating System Concept
Ch1-Operating System ConceptCh1-Operating System Concept
Ch1-Operating System Concept
 
Chapter 6 - Process Synchronization
Chapter 6 - Process SynchronizationChapter 6 - Process Synchronization
Chapter 6 - Process Synchronization
 
Chapter 1: Introduction to Operating System
Chapter 1: Introduction to Operating SystemChapter 1: Introduction to Operating System
Chapter 1: Introduction to Operating System
 
Semaphores
SemaphoresSemaphores
Semaphores
 

Ähnlich wie Process threads operating system.

Ähnlich wie Process threads operating system. (20)

14712-l4.pptx
14712-l4.pptx14712-l4.pptx
14712-l4.pptx
 
ch03.pptx
ch03.pptxch03.pptx
ch03.pptx
 
ch3.pptx
ch3.pptxch3.pptx
ch3.pptx
 
ch3.pptx
ch3.pptxch3.pptx
ch3.pptx
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 
Unit II - 1 - Operating System Process
Unit II - 1 - Operating System ProcessUnit II - 1 - Operating System Process
Unit II - 1 - Operating System Process
 
Processes
ProcessesProcesses
Processes
 
2.ch3 Process (1).ppt
2.ch3 Process (1).ppt2.ch3 Process (1).ppt
2.ch3 Process (1).ppt
 
Ch3OperSys
Ch3OperSysCh3OperSys
Ch3OperSys
 
OperatingSystemChp3
OperatingSystemChp3OperatingSystemChp3
OperatingSystemChp3
 
Cs8493 unit 2
Cs8493 unit 2Cs8493 unit 2
Cs8493 unit 2
 
ch3_LU6_LU7_Lecture_1691052564579.pptx
ch3_LU6_LU7_Lecture_1691052564579.pptxch3_LU6_LU7_Lecture_1691052564579.pptx
ch3_LU6_LU7_Lecture_1691052564579.pptx
 
3.Process Management
3.Process Management3.Process Management
3.Process Management
 
Week03-Ch3-Process Concept.pptx.gfhgvjhg
Week03-Ch3-Process Concept.pptx.gfhgvjhgWeek03-Ch3-Process Concept.pptx.gfhgvjhg
Week03-Ch3-Process Concept.pptx.gfhgvjhg
 
3 processes
3 processes3 processes
3 processes
 
ch3_smu.ppt
ch3_smu.pptch3_smu.ppt
ch3_smu.ppt
 
ch3-lect7.pptx
ch3-lect7.pptxch3-lect7.pptx
ch3-lect7.pptx
 
CH03.pdf
CH03.pdfCH03.pdf
CH03.pdf
 
ch3 (1).ppt
ch3 (1).pptch3 (1).ppt
ch3 (1).ppt
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 

Mehr von Reham Maher El-Safarini

Global threat-landscape report by fortinet.
Global threat-landscape report by fortinet.Global threat-landscape report by fortinet.
Global threat-landscape report by fortinet.Reham Maher El-Safarini
 
Application and database migration workshop
Application and database migration workshopApplication and database migration workshop
Application and database migration workshopReham Maher El-Safarini
 
Security and governance with aws control tower and aws organizations
Security and governance with aws control tower and aws organizationsSecurity and governance with aws control tower and aws organizations
Security and governance with aws control tower and aws organizationsReham Maher El-Safarini
 
2. migration, disaster recovery and business continuity in the cloud
2. migration, disaster recovery and business continuity in the cloud2. migration, disaster recovery and business continuity in the cloud
2. migration, disaster recovery and business continuity in the cloudReham Maher El-Safarini
 

Mehr von Reham Maher El-Safarini (20)

Ux
Ux Ux
Ux
 
Global threat-landscape report by fortinet.
Global threat-landscape report by fortinet.Global threat-landscape report by fortinet.
Global threat-landscape report by fortinet.
 
Dynamics AX/ X++
Dynamics AX/ X++Dynamics AX/ X++
Dynamics AX/ X++
 
Microsoft sql-and-the-gdpr
Microsoft sql-and-the-gdprMicrosoft sql-and-the-gdpr
Microsoft sql-and-the-gdpr
 
AWS Cloud economics
AWS Cloud economicsAWS Cloud economics
AWS Cloud economics
 
Cloud skills development
Cloud skills developmentCloud skills development
Cloud skills development
 
AWS cloud adoption framework (caf)
AWS cloud adoption framework (caf)AWS cloud adoption framework (caf)
AWS cloud adoption framework (caf)
 
Application and database migration workshop
Application and database migration workshopApplication and database migration workshop
Application and database migration workshop
 
Containers on AWS
Containers on AWSContainers on AWS
Containers on AWS
 
Security and governance with aws control tower and aws organizations
Security and governance with aws control tower and aws organizationsSecurity and governance with aws control tower and aws organizations
Security and governance with aws control tower and aws organizations
 
Digital transformation on aws
Digital transformation on awsDigital transformation on aws
Digital transformation on aws
 
Security in the cloud
Security in the cloudSecurity in the cloud
Security in the cloud
 
2. migration, disaster recovery and business continuity in the cloud
2. migration, disaster recovery and business continuity in the cloud2. migration, disaster recovery and business continuity in the cloud
2. migration, disaster recovery and business continuity in the cloud
 
1. aws overview
1. aws overview1. aws overview
1. aws overview
 
Pgp
PgpPgp
Pgp
 
ssl for securing
ssl for securingssl for securing
ssl for securing
 
03 unity 3_d_part_2
03 unity 3_d_part_203 unity 3_d_part_2
03 unity 3_d_part_2
 
02 unity 3_d_part_1
02 unity 3_d_part_102 unity 3_d_part_1
02 unity 3_d_part_1
 
01 unity 3_d_introduction
01 unity 3_d_introduction01 unity 3_d_introduction
01 unity 3_d_introduction
 
unity basics
unity basicsunity basics
unity basics
 

Kürzlich hochgeladen

Forensic limnology of diatoms by Sanjai.pptx
Forensic limnology of diatoms by Sanjai.pptxForensic limnology of diatoms by Sanjai.pptx
Forensic limnology of diatoms by Sanjai.pptxkumarsanjai28051
 
Vision and reflection on Mining Software Repositories research in 2024
Vision and reflection on Mining Software Repositories research in 2024Vision and reflection on Mining Software Repositories research in 2024
Vision and reflection on Mining Software Repositories research in 2024AyushiRastogi48
 
Pests of castor_Binomics_Identification_Dr.UPR.pdf
Pests of castor_Binomics_Identification_Dr.UPR.pdfPests of castor_Binomics_Identification_Dr.UPR.pdf
Pests of castor_Binomics_Identification_Dr.UPR.pdfPirithiRaju
 
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.PraveenaKalaiselvan1
 
Microteaching on terms used in filtration .Pharmaceutical Engineering
Microteaching on terms used in filtration .Pharmaceutical EngineeringMicroteaching on terms used in filtration .Pharmaceutical Engineering
Microteaching on terms used in filtration .Pharmaceutical EngineeringPrajakta Shinde
 
Four Spheres of the Earth Presentation.ppt
Four Spheres of the Earth Presentation.pptFour Spheres of the Earth Presentation.ppt
Four Spheres of the Earth Presentation.pptJoemSTuliba
 
Pests of Blackgram, greengram, cowpea_Dr.UPR.pdf
Pests of Blackgram, greengram, cowpea_Dr.UPR.pdfPests of Blackgram, greengram, cowpea_Dr.UPR.pdf
Pests of Blackgram, greengram, cowpea_Dr.UPR.pdfPirithiRaju
 
User Guide: Capricorn FLX™ Weather Station
User Guide: Capricorn FLX™ Weather StationUser Guide: Capricorn FLX™ Weather Station
User Guide: Capricorn FLX™ Weather StationColumbia Weather Systems
 
Neurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 trNeurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 trssuser06f238
 
Pests of safflower_Binomics_Identification_Dr.UPR.pdf
Pests of safflower_Binomics_Identification_Dr.UPR.pdfPests of safflower_Binomics_Identification_Dr.UPR.pdf
Pests of safflower_Binomics_Identification_Dr.UPR.pdfPirithiRaju
 
THE ROLE OF PHARMACOGNOSY IN TRADITIONAL AND MODERN SYSTEM OF MEDICINE.pptx
THE ROLE OF PHARMACOGNOSY IN TRADITIONAL AND MODERN SYSTEM OF MEDICINE.pptxTHE ROLE OF PHARMACOGNOSY IN TRADITIONAL AND MODERN SYSTEM OF MEDICINE.pptx
THE ROLE OF PHARMACOGNOSY IN TRADITIONAL AND MODERN SYSTEM OF MEDICINE.pptxNandakishor Bhaurao Deshmukh
 
Call Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCR
Call Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCRCall Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCR
Call Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCRlizamodels9
 
OECD bibliometric indicators: Selected highlights, April 2024
OECD bibliometric indicators: Selected highlights, April 2024OECD bibliometric indicators: Selected highlights, April 2024
OECD bibliometric indicators: Selected highlights, April 2024innovationoecd
 
Speech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptxSpeech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptxpriyankatabhane
 
User Guide: Pulsar™ Weather Station (Columbia Weather Systems)
User Guide: Pulsar™ Weather Station (Columbia Weather Systems)User Guide: Pulsar™ Weather Station (Columbia Weather Systems)
User Guide: Pulsar™ Weather Station (Columbia Weather Systems)Columbia Weather Systems
 
Pests of Bengal gram_Identification_Dr.UPR.pdf
Pests of Bengal gram_Identification_Dr.UPR.pdfPests of Bengal gram_Identification_Dr.UPR.pdf
Pests of Bengal gram_Identification_Dr.UPR.pdfPirithiRaju
 
Microphone- characteristics,carbon microphone, dynamic microphone.pptx
Microphone- characteristics,carbon microphone, dynamic microphone.pptxMicrophone- characteristics,carbon microphone, dynamic microphone.pptx
Microphone- characteristics,carbon microphone, dynamic microphone.pptxpriyankatabhane
 
Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...
Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...
Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...lizamodels9
 
User Guide: Orion™ Weather Station (Columbia Weather Systems)
User Guide: Orion™ Weather Station (Columbia Weather Systems)User Guide: Orion™ Weather Station (Columbia Weather Systems)
User Guide: Orion™ Weather Station (Columbia Weather Systems)Columbia Weather Systems
 

Kürzlich hochgeladen (20)

Forensic limnology of diatoms by Sanjai.pptx
Forensic limnology of diatoms by Sanjai.pptxForensic limnology of diatoms by Sanjai.pptx
Forensic limnology of diatoms by Sanjai.pptx
 
Vision and reflection on Mining Software Repositories research in 2024
Vision and reflection on Mining Software Repositories research in 2024Vision and reflection on Mining Software Repositories research in 2024
Vision and reflection on Mining Software Repositories research in 2024
 
Pests of castor_Binomics_Identification_Dr.UPR.pdf
Pests of castor_Binomics_Identification_Dr.UPR.pdfPests of castor_Binomics_Identification_Dr.UPR.pdf
Pests of castor_Binomics_Identification_Dr.UPR.pdf
 
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
 
Microteaching on terms used in filtration .Pharmaceutical Engineering
Microteaching on terms used in filtration .Pharmaceutical EngineeringMicroteaching on terms used in filtration .Pharmaceutical Engineering
Microteaching on terms used in filtration .Pharmaceutical Engineering
 
Four Spheres of the Earth Presentation.ppt
Four Spheres of the Earth Presentation.pptFour Spheres of the Earth Presentation.ppt
Four Spheres of the Earth Presentation.ppt
 
Pests of Blackgram, greengram, cowpea_Dr.UPR.pdf
Pests of Blackgram, greengram, cowpea_Dr.UPR.pdfPests of Blackgram, greengram, cowpea_Dr.UPR.pdf
Pests of Blackgram, greengram, cowpea_Dr.UPR.pdf
 
User Guide: Capricorn FLX™ Weather Station
User Guide: Capricorn FLX™ Weather StationUser Guide: Capricorn FLX™ Weather Station
User Guide: Capricorn FLX™ Weather Station
 
Neurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 trNeurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 tr
 
Pests of safflower_Binomics_Identification_Dr.UPR.pdf
Pests of safflower_Binomics_Identification_Dr.UPR.pdfPests of safflower_Binomics_Identification_Dr.UPR.pdf
Pests of safflower_Binomics_Identification_Dr.UPR.pdf
 
THE ROLE OF PHARMACOGNOSY IN TRADITIONAL AND MODERN SYSTEM OF MEDICINE.pptx
THE ROLE OF PHARMACOGNOSY IN TRADITIONAL AND MODERN SYSTEM OF MEDICINE.pptxTHE ROLE OF PHARMACOGNOSY IN TRADITIONAL AND MODERN SYSTEM OF MEDICINE.pptx
THE ROLE OF PHARMACOGNOSY IN TRADITIONAL AND MODERN SYSTEM OF MEDICINE.pptx
 
Call Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCR
Call Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCRCall Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCR
Call Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCR
 
OECD bibliometric indicators: Selected highlights, April 2024
OECD bibliometric indicators: Selected highlights, April 2024OECD bibliometric indicators: Selected highlights, April 2024
OECD bibliometric indicators: Selected highlights, April 2024
 
Speech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptxSpeech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptx
 
User Guide: Pulsar™ Weather Station (Columbia Weather Systems)
User Guide: Pulsar™ Weather Station (Columbia Weather Systems)User Guide: Pulsar™ Weather Station (Columbia Weather Systems)
User Guide: Pulsar™ Weather Station (Columbia Weather Systems)
 
Hot Sexy call girls in Moti Nagar,🔝 9953056974 🔝 escort Service
Hot Sexy call girls in  Moti Nagar,🔝 9953056974 🔝 escort ServiceHot Sexy call girls in  Moti Nagar,🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Moti Nagar,🔝 9953056974 🔝 escort Service
 
Pests of Bengal gram_Identification_Dr.UPR.pdf
Pests of Bengal gram_Identification_Dr.UPR.pdfPests of Bengal gram_Identification_Dr.UPR.pdf
Pests of Bengal gram_Identification_Dr.UPR.pdf
 
Microphone- characteristics,carbon microphone, dynamic microphone.pptx
Microphone- characteristics,carbon microphone, dynamic microphone.pptxMicrophone- characteristics,carbon microphone, dynamic microphone.pptx
Microphone- characteristics,carbon microphone, dynamic microphone.pptx
 
Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...
Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...
Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...
 
User Guide: Orion™ Weather Station (Columbia Weather Systems)
User Guide: Orion™ Weather Station (Columbia Weather Systems)User Guide: Orion™ Weather Station (Columbia Weather Systems)
User Guide: Orion™ Weather Station (Columbia Weather Systems)
 

Process threads operating system.

  • 1. 3.1 Silberschatz, Galvin and GagneOperating System Concepts – 8th Edition Process An operating system executes a variety of programs: Batch system – jobs Time-shared systems – user programs or tasks Process – a program in execution; process execution must progress in sequential fashion A process includes: program counter stack data section Topics: Operations in Process Scheduling Interprocess Communication
  • 2. 3.2 Silberschatz, Galvin and GagneOperating System Concepts – 8th Edition Process in Memory
  • 3. 3.3 Silberschatz, Galvin and GagneOperating System Concepts – 8th Edition Process State As a process executes, it changes state new: The process is being created running: Instructions are being executed waiting: The process is waiting for some event to occur ready: The process is waiting to be assigned to a processor terminated: The process has finished execution
  • 4. 3.4 Silberschatz, Galvin and GagneOperating System Concepts – 8th Edition Process States and Transition
  • 5. 3.5 Silberschatz, Galvin and GagneOperating System Concepts – 8th Edition Process Control Block (PCB)
  • 6. 3.6 Silberschatz, Galvin and GagneOperating System Concepts – 8th Edition 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 Time dependent on hardware support
  • 7. 3.7 Silberschatz, Galvin and GagneOperating System Concepts – 8th Edition CPU Switch From Process to Process
  • 8. 3.8 Silberschatz, Galvin and GagneOperating System Concepts – 8th Edition 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) Options in Resource sharing Parent and children share all resources Children share subset of parent’s resources Parent and child share no resources Options Execution Parent and children execute concurrently Parent waits until children terminate
  • 9. 3.9 Silberschatz, Galvin and GagneOperating System Concepts – 8th Edition Process Creation (Cont.) Options n 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
  • 10. 3.10 Silberschatz, Galvin and GagneOperating System Concepts – 8th Edition Unix Fork/Exec/Exit/Wait Example int pid = fork(); Create a new process that is a clone of its parent. exec*(“program” [, argvp, envp]); Overlay the calling process virtual memory with a new program, and transfer control to it. exit(status); Exit with status, destroying the process. int pid = wait*(&status); Wait for exit (or other status change) of a child. fork parent fork child wait exit exec initialize child context
  • 11. 3.11 Silberschatz, Galvin and GagneOperating System Concepts – 8th Edition Example: Process Creation in Unix int pid; int status = 0; if (pid = fork()) { /* parent */ ….. pid = wait(&status); } else { /* child */ ….. exit(status); } Parent uses wait to sleep until the child exits; wait returns child pid and status. Wait variants allow wait on a specific child, or notification of stops and other signals. The fork syscall returns twice: it returns a zero to the child and the child process ID (pid) to the parent.
  • 12. 3.12 Silberschatz, Galvin and GagneOperating System Concepts – 8th Edition C Program Forking Separate Process int main() { int 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); } }
  • 13. 3.14 Silberschatz, Galvin and GagneOperating System Concepts – 8th Edition Process Termination Process executes last statement and asks the operating system to delete it (exit) Output data from child to parent (via wait) Process’ resources are deallocated by operating system 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
  • 14. 3.15 Silberschatz, Galvin and GagneOperating System Concepts – 8th Edition Communications Models: Shared memory or Message Passing
  • 15. 3.16 Silberschatz, Galvin and GagneOperating System Concepts – 8th Edition 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
  • 16. 3.17 Silberschatz, Galvin and GagneOperating System Concepts – 8th Edition Motivation for multi-threaded servers
  • 17. 3.18 Silberschatz, Galvin and GagneOperating System Concepts – 8th Edition Single and Multithreaded Processes
  • 18. 3.19 Silberschatz, Galvin and GagneOperating System Concepts – 8th Edition Benefits Responsiveness Resource Sharing Economy Scalability
  • 19. 3.20 Silberschatz, Galvin and GagneOperating System Concepts – 8th Edition Kernel Threads Recognized and supported by the OS Kernel OS explicitly performs scheduling and context switching of kernel threads Examples Windows XP/2000 Solaris Linux Tru64 UNIX Mac OS X
  • 20. 3.21 Silberschatz, Galvin and GagneOperating System Concepts – 8th Edition User Threads Thread management done by user-level threads library OS kernel does not know/recognize there are multiple threads running in a user program. The user program (library) is responsible for scheduling and context switching of its threads. Three primary thread libraries: POSIX Pthreads Win32 threads Java threads
  • 21. 3.22 Silberschatz, Galvin and GagneOperating System Concepts – 8th Edition User- vs. Kernel-level Threads From W. Stallings, Operating Systems, 6th Edition
  • 22. 3.23 Silberschatz, Galvin and GagneOperating System Concepts – 8th Edition Pthreads May be provided either as user-level or kernel-level A POSIX standard (IEEE 1003.1c) API for thread creation and synchronization API specifies behavior of the thread library, implementation is up to development of the library Common in UNIX operating systems (Solaris, Linux, Mac OS X)
  • 23. 3.24 Silberschatz, Galvin and GagneOperating System Concepts – 8th Edition Java Threads Java threads are managed by the JVM Typically implemented using the threads model provided by underlying OS Java threads may be created by: Extending Thread class Implementing the Runnable interface