SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

Inter Process Communication
Inter Process CommunicationInter Process Communication
Inter Process CommunicationAdeel Rasheed
 
Operating system structures
Operating system structuresOperating system structures
Operating system structuresMohd Arif
 
Virtual memory
Virtual memoryVirtual memory
Virtual memoryAnuj Modi
 
Process management in os
Process management in osProcess management in os
Process management in osMiong Lazaro
 
Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory managementrprajat007
 
computer system structure
computer system structurecomputer system structure
computer system structureHAMZA AHMED
 
Operating system services 9
Operating system services 9Operating system services 9
Operating system services 9myrajendra
 
Introduction of Memory Management
Introduction of Memory Management Introduction of Memory Management
Introduction of Memory Management Maitree Patel
 
Operating Systems - "Chapter 4: Multithreaded Programming"
Operating Systems - "Chapter 4:  Multithreaded Programming"Operating Systems - "Chapter 4:  Multithreaded Programming"
Operating Systems - "Chapter 4: Multithreaded Programming"Ra'Fat Al-Msie'deen
 
Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Mukesh Chinta
 
Distributed operating system(os)
Distributed operating system(os)Distributed operating system(os)
Distributed operating system(os)Dinesh Modak
 
Distributed database management system
Distributed database management  systemDistributed database management  system
Distributed database management systemPooja Dixit
 
Computer architecture page replacement algorithms
Computer architecture page replacement algorithmsComputer architecture page replacement algorithms
Computer architecture page replacement algorithmsMazin Alwaaly
 
File concept and access method
File concept and access methodFile concept and access method
File concept and access methodrajshreemuthiah
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OSvampugani
 
Contiguous Memory Allocation.ppt
Contiguous Memory Allocation.pptContiguous Memory Allocation.ppt
Contiguous Memory Allocation.pptinfomerlin
 

Tendances (20)

Inter Process Communication
Inter Process CommunicationInter Process Communication
Inter Process Communication
 
Operating system structures
Operating system structuresOperating system structures
Operating system structures
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Process management in os
Process management in osProcess management in os
Process management in os
 
Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory management
 
computer system structure
computer system structurecomputer system structure
computer system structure
 
Operating system services 9
Operating system services 9Operating system services 9
Operating system services 9
 
Introduction of Memory Management
Introduction of Memory Management Introduction of Memory Management
Introduction of Memory Management
 
Operating Systems - "Chapter 4: Multithreaded Programming"
Operating Systems - "Chapter 4:  Multithreaded Programming"Operating Systems - "Chapter 4:  Multithreaded Programming"
Operating Systems - "Chapter 4: Multithreaded Programming"
 
Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)
 
CPU Scheduling Algorithms
CPU Scheduling AlgorithmsCPU Scheduling Algorithms
CPU Scheduling Algorithms
 
File system structure
File system structureFile system structure
File system structure
 
Virtual memory ppt
Virtual memory pptVirtual memory ppt
Virtual memory ppt
 
Distributed operating system(os)
Distributed operating system(os)Distributed operating system(os)
Distributed operating system(os)
 
Distributed database management system
Distributed database management  systemDistributed database management  system
Distributed database management system
 
Computer architecture page replacement algorithms
Computer architecture page replacement algorithmsComputer architecture page replacement algorithms
Computer architecture page replacement algorithms
 
File concept and access method
File concept and access methodFile concept and access method
File concept and access method
 
Disk scheduling
Disk schedulingDisk scheduling
Disk scheduling
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 
Contiguous Memory Allocation.ppt
Contiguous Memory Allocation.pptContiguous Memory Allocation.ppt
Contiguous Memory Allocation.ppt
 

Similaire à Process threads operating system.

Similaire à 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
 

Plus de 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
 

Plus de 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
 

Dernier

Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticsPulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticssakshisoni2385
 
Animal Communication- Auditory and Visual.pptx
Animal Communication- Auditory and Visual.pptxAnimal Communication- Auditory and Visual.pptx
Animal Communication- Auditory and Visual.pptxUmerFayaz5
 
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRStunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRDelhi Call girls
 
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡anilsa9823
 
Physiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptxPhysiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptxAArockiyaNisha
 
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bAsymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bSérgio Sacani
 
Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoSérgio Sacani
 
fundamental of entomology all in one topics of entomology
fundamental of entomology all in one topics of entomologyfundamental of entomology all in one topics of entomology
fundamental of entomology all in one topics of entomologyDrAnita Sharma
 
Botany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questionsBotany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questionsSumit Kumar yadav
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsSérgio Sacani
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...RohitNehra6
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSarthak Sekhar Mondal
 
Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)PraveenaKalaiselvan1
 
Nanoparticles synthesis and characterization​ ​
Nanoparticles synthesis and characterization​  ​Nanoparticles synthesis and characterization​  ​
Nanoparticles synthesis and characterization​ ​kaibalyasahoo82800
 
Chemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfChemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfSumit Kumar yadav
 
Pests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdfPests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdfPirithiRaju
 
Disentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOSTDisentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOSTSérgio Sacani
 
Botany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfBotany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfSumit Kumar yadav
 
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 60009654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000Sapana Sha
 

Dernier (20)

Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticsPulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
 
Animal Communication- Auditory and Visual.pptx
Animal Communication- Auditory and Visual.pptxAnimal Communication- Auditory and Visual.pptx
Animal Communication- Auditory and Visual.pptx
 
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRStunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
 
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
 
Physiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptxPhysiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptx
 
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bAsymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
 
Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on Io
 
fundamental of entomology all in one topics of entomology
fundamental of entomology all in one topics of entomologyfundamental of entomology all in one topics of entomology
fundamental of entomology all in one topics of entomology
 
Botany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questionsBotany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questions
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...
 
CELL -Structural and Functional unit of life.pdf
CELL -Structural and Functional unit of life.pdfCELL -Structural and Functional unit of life.pdf
CELL -Structural and Functional unit of life.pdf
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
 
Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)
 
Nanoparticles synthesis and characterization​ ​
Nanoparticles synthesis and characterization​  ​Nanoparticles synthesis and characterization​  ​
Nanoparticles synthesis and characterization​ ​
 
Chemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfChemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdf
 
Pests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdfPests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdf
 
Disentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOSTDisentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOST
 
Botany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfBotany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdf
 
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 60009654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
 

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