SlideShare a Scribd company logo
UNIT -5  PROCESS CONTROL  ,[object Object],[object Object],[object Object],[object Object]
Process identifiers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
#include <unistd.h> #include <sys/types.h> pid_t getpid (void); pid_t getppid (void); uid_t getuid (void); uid_t geteuid (void); gid_t getgid (void); gid_t getegid (void);
Fork function   ,[object Object],#include <sys/types.h> #include <unistd.h> pid_t fork (void);
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object]
vfork ,[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
exit functions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Wait and waitpid functions ,[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],#include <sys/wait.h> #include <sys/types.h> pid_t wait (int *statloc); pid_t waitpid (pid_t pid,int *statloc , int options );
[object Object],[object Object],[object Object]
[object Object],WIFEXITED TRUE – if child terminated normally WEXITSTATUS  – is used to fetch the lower 8 bits of argument child passed to exit or _exit
WIFSIGNALED TRUE – if child terminated abnormally WTERMSIG  – is used to fetch the signal number that caused termination WCOREDUMP – is true is core file was generated WIFSTOPPED TRUE – for a child that is currently stopped WSTOPSIG  -- is used to fetch the signal number that caused child to stop
[object Object],[object Object],[object Object],[object Object],[object Object],waitpid
[object Object],[object Object],[object Object],WNOHANG Waitpid will not block if the child specified is not available WUNTRACED supports job control
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
wait3 and wait4 functions ,[object Object]
#include <sys/wait.h> #include <sys/types.h> #include <sys/times.h> #include <sys/resource.h> pid_t wait3 (int *statloc ,int options, struct  rusage *rusage ); pid_t wait4 (pid_t pid ,int *statloc ,int  options, struct rusage *rusage );
Race condition ,[object Object]
Program with race condition ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
exec functions ,[object Object],[object Object],[object Object]
#include <unistd.h> int exec1 ( const char *pathname,  const char *arg0 ,… /*(char *) 0*/); int execv (const char *pathname, char *  const argv[ ]); int execle (const char *pathname, const  char *arg0 ,… /*(char *) 0, char  *const envp[ ] */);
int execve ( const char *pathname,  char *const argv[ ] ,  char *const  envp [ ]); int execlp (const char *filename, const  char *arg0 ,… /*(char *) 0*/); int execvp (const char *filename ,char  *const argv[ ] );
[object Object],Build argv Build argv Build argv Try each PATH prefix use environ execle execv execve execl execlp execvp
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Changing user IDs and group IDs ,[object Object],#include <sys/types.h> #include <unistd.h> int setuid (uid_t uid); int setgid (gid_t gid);
[object Object],[object Object],[object Object],[object Object]
ID exec Set-user-ID bit off exec Set-user-Id bit on Real user ID Effective user ID Saved set  user ID unchanged  unchanged  copied from effective user ID unchanged Set from user ID of program file copied from effective user ID
ID Super user Un privileged user Real user ID Effective user ID Saved set-user ID Set to uid Set to uid Set to uid unchanged Set to uid unchanged
setreuid and setregid #include <sys/types.h> #include <unistd.h> int setreuid (uid_t ruid, uid_t euid); int setregid (gid_t rgid,gid_t egid);
seteuid and setegid #include <sys/types.h> #include <unistd.h> int seteuid (uid_t euid); int setegid (gid_t egid);
Real user ID Effective User ID Saved Set-user-ID Superuser setreuid Superuser setuid Superuser seteuid euid uid uid uid uid Unprivileged Setuid or seteuid Unprivileged Setuid or seteuid Exec of  set-user-id Unprivileged setreuid Unprivileged setreuid
Interpreter files ,[object Object],[object Object],[object Object],[object Object],[object Object]
/*example of interpreter file*/ ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object]
system function ,[object Object],[object Object],#include <stdlib.h> int system (const char  *cmdstring);
[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Process accounting ,[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
User identification ,[object Object],#include <unistd.h> char *getlogin (void);
Process times ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],#include <sys/times.h> clock_t times (struct tms *buf);
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object]
Terminal logins ,[object Object],init init init Process ID 1 Forks once per terminal Each child execs getty fork exec
init init getty login fork Reads /etc/ttys Forks once per terminal creats empty environment opens terminal device reads user name exec exec
user at  a terminal terminal device  driver login shell init through login and getty fd 0,1,2 RS – 232 connection process ID 1
network login inetd init inetd telnetd fork/exec of/bin/sh which executes shell script /etc/rc when connection request arives  from telnet user fork exec proces ID 1
pseudo-terminal device driver user at a terminal login shell init through inetd, telenetd and login fd 0, 1, 2 network connection through telnetd server and telnetd client process ID 1
Process groups ,[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],#include <sys/types.h> #include <unistd.h> pid_t  getpgrp (void);
[object Object],[object Object],[object Object]
[object Object],[object Object],#include <sys/types.h> #include <unistd.h> int setpgid (pid_t  pid , pid_t  pgid );
[object Object],[object Object]
SESSIONS ,[object Object],[object Object],[object Object],#include <sys/types.h> #include <unistd.h> pid_t setsid (void)
Login shell proc1 proc2 proc3 proc4 proc5 Process group process group Process group session Arrangement of processes into  process groups and sessions
[object Object],[object Object],[object Object],[object Object]
Controlling terminal ,[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object]
session modem disconnect ( hangup signal) Terminal input and  Terminal-generated signals Process groups and sessions showing controlling terminal Login shell proc1 proc2 proc3 proc4 proc5 background process group Session leader = Controlling process background process group foreground process group Controlling terminal
tcgetpgrp and tcsetpgrp Functions ,[object Object],#include <sys/types.h> #include<unistd.h> pid_t tcgetpgrp(int  filedes ); int tcsetpgrp(int  filedes , pid_t  pgrpid );
[object Object],[object Object]
Job Control ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Shell Execution Of Programs ,[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object]
Orphaned process groups ,[object Object],[object Object]
Login shell(PID 442) Parent( PID 512) Child(PID 513) Process group 512 Process group 442 Fork/exec session fork
[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object]
[object Object],[object Object]
Creating an orphaned process group ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object]
Questions  ,[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object]

More Related Content

What's hot

Unit 3
Unit  3Unit  3
Unit 3siddr
 
OpenGurukul : Language : PHP
OpenGurukul : Language : PHPOpenGurukul : Language : PHP
OpenGurukul : Language : PHPOpen Gurukul
 
Gift-VT Tools Development Overview
Gift-VT Tools Development OverviewGift-VT Tools Development Overview
Gift-VT Tools Development Overviewstn_tkiller
 
Game unleashedjavascript
Game unleashedjavascriptGame unleashedjavascript
Game unleashedjavascriptReece Carlson
 
File Handling in C Programming
File Handling in C ProgrammingFile Handling in C Programming
File Handling in C ProgrammingRavindraSalunke3
 
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)CODE BLUE
 
Java Bytecode Fundamentals - JUG.lv
Java Bytecode Fundamentals - JUG.lvJava Bytecode Fundamentals - JUG.lv
Java Bytecode Fundamentals - JUG.lvAnton Arhipov
 
Runtime Symbol Resolution
Runtime Symbol ResolutionRuntime Symbol Resolution
Runtime Symbol ResolutionKen Kawamoto
 
Unit 8
Unit 8Unit 8
Unit 8siddr
 
MeCC: Memory Comparison-based Code Clone Detector
MeCC: Memory Comparison-based Code Clone DetectorMeCC: Memory Comparison-based Code Clone Detector
MeCC: Memory Comparison-based Code Clone Detector영범 정
 
Rust LDN 24 7 19 Oxidising the Command Line
Rust LDN 24 7 19 Oxidising the Command LineRust LDN 24 7 19 Oxidising the Command Line
Rust LDN 24 7 19 Oxidising the Command LineMatt Provost
 
Programming Under Linux In Python
Programming Under Linux In PythonProgramming Under Linux In Python
Programming Under Linux In PythonMarwan Osman
 

What's hot (20)

Unit 3
Unit  3Unit  3
Unit 3
 
Отладка в GDB
Отладка в GDBОтладка в GDB
Отладка в GDB
 
OpenGurukul : Language : PHP
OpenGurukul : Language : PHPOpenGurukul : Language : PHP
OpenGurukul : Language : PHP
 
Gift-VT Tools Development Overview
Gift-VT Tools Development OverviewGift-VT Tools Development Overview
Gift-VT Tools Development Overview
 
C language updated
C language updatedC language updated
C language updated
 
NIO and NIO2
NIO and NIO2NIO and NIO2
NIO and NIO2
 
Game unleashedjavascript
Game unleashedjavascriptGame unleashedjavascript
Game unleashedjavascript
 
File Handling in C Programming
File Handling in C ProgrammingFile Handling in C Programming
File Handling in C Programming
 
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
 
Java Bytecode Fundamentals - JUG.lv
Java Bytecode Fundamentals - JUG.lvJava Bytecode Fundamentals - JUG.lv
Java Bytecode Fundamentals - JUG.lv
 
Constructor,destructors cpp
Constructor,destructors cppConstructor,destructors cpp
Constructor,destructors cpp
 
C++11 talk
C++11 talkC++11 talk
C++11 talk
 
Runtime Symbol Resolution
Runtime Symbol ResolutionRuntime Symbol Resolution
Runtime Symbol Resolution
 
Unit 8
Unit 8Unit 8
Unit 8
 
MeCC: Memory Comparison-based Code Clone Detector
MeCC: Memory Comparison-based Code Clone DetectorMeCC: Memory Comparison-based Code Clone Detector
MeCC: Memory Comparison-based Code Clone Detector
 
Rust LDN 24 7 19 Oxidising the Command Line
Rust LDN 24 7 19 Oxidising the Command LineRust LDN 24 7 19 Oxidising the Command Line
Rust LDN 24 7 19 Oxidising the Command Line
 
Python idiomatico
Python idiomaticoPython idiomatico
Python idiomatico
 
C&cpu
C&cpuC&cpu
C&cpu
 
Linux
LinuxLinux
Linux
 
Programming Under Linux In Python
Programming Under Linux In PythonProgramming Under Linux In Python
Programming Under Linux In Python
 

Viewers also liked

Unit 7
Unit 7Unit 7
Unit 7siddr
 
Chapter 3
Chapter 3Chapter 3
Chapter 3lopjuan
 
Part 03 File System Implementation in Linux
Part 03 File System Implementation in LinuxPart 03 File System Implementation in Linux
Part 03 File System Implementation in LinuxTushar B Kute
 
1327 Addressing Modes Of 8086
1327 Addressing Modes Of 80861327 Addressing Modes Of 8086
1327 Addressing Modes Of 8086techbed
 
Addressing modes of 8051
Addressing modes of 8051Addressing modes of 8051
Addressing modes of 8051SARITHA REDDY
 
Unix system programming
Unix system programmingUnix system programming
Unix system programmingSyed Mustafa
 
Unix operating system
Unix operating systemUnix operating system
Unix operating systemABhay Panchal
 
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction setSaumitra Rukmangad
 

Viewers also liked (12)

Unit 7
Unit 7Unit 7
Unit 7
 
Sysprog 16
Sysprog 16Sysprog 16
Sysprog 16
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Prog ii
Prog iiProg ii
Prog ii
 
Usp notes unit6-8
Usp notes unit6-8Usp notes unit6-8
Usp notes unit6-8
 
Part 03 File System Implementation in Linux
Part 03 File System Implementation in LinuxPart 03 File System Implementation in Linux
Part 03 File System Implementation in Linux
 
1327 Addressing Modes Of 8086
1327 Addressing Modes Of 80861327 Addressing Modes Of 8086
1327 Addressing Modes Of 8086
 
Addressing modes of 8051
Addressing modes of 8051Addressing modes of 8051
Addressing modes of 8051
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
Unix system programming
Unix system programmingUnix system programming
Unix system programming
 
Unix operating system
Unix operating systemUnix operating system
Unix operating system
 
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
 

Similar to Unit 5

UNIX_Process Control_Module3.pptx
UNIX_Process Control_Module3.pptxUNIX_Process Control_Module3.pptx
UNIX_Process Control_Module3.pptxraunakkumar290158
 
Tested on ubuntu,Linux#include stdio.h #include string.h.pdf
Tested on ubuntu,Linux#include stdio.h #include string.h.pdfTested on ubuntu,Linux#include stdio.h #include string.h.pdf
Tested on ubuntu,Linux#include stdio.h #include string.h.pdfaquacare2008
 
This is my code- #include -llvm-IR-LegacyPassManager-h- #include -llv.pdf
This is my code-  #include -llvm-IR-LegacyPassManager-h- #include -llv.pdfThis is my code-  #include -llvm-IR-LegacyPassManager-h- #include -llv.pdf
This is my code- #include -llvm-IR-LegacyPassManager-h- #include -llv.pdfEricvtJFraserr
 
assign4assign4_part1bonnie.c This is a file system ben.docx
assign4assign4_part1bonnie.c  This is a file system ben.docxassign4assign4_part1bonnie.c  This is a file system ben.docx
assign4assign4_part1bonnie.c This is a file system ben.docxfestockton
 
Consider the fork_examplec code under Example code for pr.pdf
Consider the fork_examplec code under Example code for pr.pdfConsider the fork_examplec code under Example code for pr.pdf
Consider the fork_examplec code under Example code for pr.pdfabinayamobiles
 
Linux Systems Programming: Process CommunCh11 Processes and Signals
Linux Systems Programming: Process CommunCh11 Processes and SignalsLinux Systems Programming: Process CommunCh11 Processes and Signals
Linux Systems Programming: Process CommunCh11 Processes and SignalsRashidFaridChishti
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesGanesh Samarthyam
 
Systems Programming Assignment Help - Processes
Systems Programming Assignment Help - ProcessesSystems Programming Assignment Help - Processes
Systems Programming Assignment Help - ProcessesHelpWithAssignment.com
 
Lecture2 process structure and programming
Lecture2   process structure and programmingLecture2   process structure and programming
Lecture2 process structure and programmingMohammed Farrag
 
What is-a-computer-process-os
What is-a-computer-process-osWhat is-a-computer-process-os
What is-a-computer-process-osManish Singh
 
Troubleshooting Plone
Troubleshooting PloneTroubleshooting Plone
Troubleshooting PloneRicado Alves
 

Similar to Unit 5 (20)

UNIX_Process Control_Module3.pptx
UNIX_Process Control_Module3.pptxUNIX_Process Control_Module3.pptx
UNIX_Process Control_Module3.pptx
 
Sysprog 11
Sysprog 11Sysprog 11
Sysprog 11
 
Tested on ubuntu,Linux#include stdio.h #include string.h.pdf
Tested on ubuntu,Linux#include stdio.h #include string.h.pdfTested on ubuntu,Linux#include stdio.h #include string.h.pdf
Tested on ubuntu,Linux#include stdio.h #include string.h.pdf
 
process creation OS
process creation OSprocess creation OS
process creation OS
 
Ipc
IpcIpc
Ipc
 
This is my code- #include -llvm-IR-LegacyPassManager-h- #include -llv.pdf
This is my code-  #include -llvm-IR-LegacyPassManager-h- #include -llv.pdfThis is my code-  #include -llvm-IR-LegacyPassManager-h- #include -llv.pdf
This is my code- #include -llvm-IR-LegacyPassManager-h- #include -llv.pdf
 
assign4assign4_part1bonnie.c This is a file system ben.docx
assign4assign4_part1bonnie.c  This is a file system ben.docxassign4assign4_part1bonnie.c  This is a file system ben.docx
assign4assign4_part1bonnie.c This is a file system ben.docx
 
Consider the fork_examplec code under Example code for pr.pdf
Consider the fork_examplec code under Example code for pr.pdfConsider the fork_examplec code under Example code for pr.pdf
Consider the fork_examplec code under Example code for pr.pdf
 
Os lab final
Os lab finalOs lab final
Os lab final
 
Process management
Process managementProcess management
Process management
 
Lecture 8 9 process_concept
Lecture 8 9 process_conceptLecture 8 9 process_concept
Lecture 8 9 process_concept
 
forkwork.pptx
forkwork.pptxforkwork.pptx
forkwork.pptx
 
Linux Systems Programming: Process CommunCh11 Processes and Signals
Linux Systems Programming: Process CommunCh11 Processes and SignalsLinux Systems Programming: Process CommunCh11 Processes and Signals
Linux Systems Programming: Process CommunCh11 Processes and Signals
 
SDE TP 4 - Processus
SDE TP 4 - ProcessusSDE TP 4 - Processus
SDE TP 4 - Processus
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java Bytecodes
 
Systems Programming Assignment Help - Processes
Systems Programming Assignment Help - ProcessesSystems Programming Assignment Help - Processes
Systems Programming Assignment Help - Processes
 
Lecture2 process structure and programming
Lecture2   process structure and programmingLecture2   process structure and programming
Lecture2 process structure and programming
 
What is-a-computer-process-os
What is-a-computer-process-osWhat is-a-computer-process-os
What is-a-computer-process-os
 
Forkexpe
ForkexpeForkexpe
Forkexpe
 
Troubleshooting Plone
Troubleshooting PloneTroubleshooting Plone
Troubleshooting Plone
 

Recently uploaded

Introduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationIntroduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationZilliz
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCzechDreamin
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backElena Simperl
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...Product School
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...Sri Ambati
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...CzechDreamin
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIES VE
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Thierry Lestable
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekCzechDreamin
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlPeter Udo Diehl
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Julian Hyde
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxDavid Michel
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...Product School
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupCatarinaPereira64715
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...Elena Simperl
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesBhaskar Mitra
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...CzechDreamin
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesThousandEyes
 

Recently uploaded (20)

Introduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationIntroduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG Evaluation
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 

Unit 5

  • 1.
  • 2.
  • 3. #include <unistd.h> #include <sys/types.h> pid_t getpid (void); pid_t getppid (void); uid_t getuid (void); uid_t geteuid (void); gid_t getgid (void); gid_t getegid (void);
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24. WIFSIGNALED TRUE – if child terminated abnormally WTERMSIG – is used to fetch the signal number that caused termination WCOREDUMP – is true is core file was generated WIFSTOPPED TRUE – for a child that is currently stopped WSTOPSIG -- is used to fetch the signal number that caused child to stop
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32. #include <sys/wait.h> #include <sys/types.h> #include <sys/times.h> #include <sys/resource.h> pid_t wait3 (int *statloc ,int options, struct rusage *rusage ); pid_t wait4 (pid_t pid ,int *statloc ,int options, struct rusage *rusage );
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41. #include <unistd.h> int exec1 ( const char *pathname, const char *arg0 ,… /*(char *) 0*/); int execv (const char *pathname, char * const argv[ ]); int execle (const char *pathname, const char *arg0 ,… /*(char *) 0, char *const envp[ ] */);
  • 42. int execve ( const char *pathname, char *const argv[ ] , char *const envp [ ]); int execlp (const char *filename, const char *arg0 ,… /*(char *) 0*/); int execvp (const char *filename ,char *const argv[ ] );
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49. ID exec Set-user-ID bit off exec Set-user-Id bit on Real user ID Effective user ID Saved set user ID unchanged unchanged copied from effective user ID unchanged Set from user ID of program file copied from effective user ID
  • 50. ID Super user Un privileged user Real user ID Effective user ID Saved set-user ID Set to uid Set to uid Set to uid unchanged Set to uid unchanged
  • 51. setreuid and setregid #include <sys/types.h> #include <unistd.h> int setreuid (uid_t ruid, uid_t euid); int setregid (gid_t rgid,gid_t egid);
  • 52. seteuid and setegid #include <sys/types.h> #include <unistd.h> int seteuid (uid_t euid); int setegid (gid_t egid);
  • 53. Real user ID Effective User ID Saved Set-user-ID Superuser setreuid Superuser setuid Superuser seteuid euid uid uid uid uid Unprivileged Setuid or seteuid Unprivileged Setuid or seteuid Exec of set-user-id Unprivileged setreuid Unprivileged setreuid
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80. init init getty login fork Reads /etc/ttys Forks once per terminal creats empty environment opens terminal device reads user name exec exec
  • 81. user at a terminal terminal device driver login shell init through login and getty fd 0,1,2 RS – 232 connection process ID 1
  • 82. network login inetd init inetd telnetd fork/exec of/bin/sh which executes shell script /etc/rc when connection request arives from telnet user fork exec proces ID 1
  • 83. pseudo-terminal device driver user at a terminal login shell init through inetd, telenetd and login fd 0, 1, 2 network connection through telnetd server and telnetd client process ID 1
  • 84.
  • 85.
  • 86.
  • 87.
  • 88.
  • 89.
  • 90. Login shell proc1 proc2 proc3 proc4 proc5 Process group process group Process group session Arrangement of processes into process groups and sessions
  • 91.
  • 92.
  • 93.
  • 94. session modem disconnect ( hangup signal) Terminal input and Terminal-generated signals Process groups and sessions showing controlling terminal Login shell proc1 proc2 proc3 proc4 proc5 background process group Session leader = Controlling process background process group foreground process group Controlling terminal
  • 95.
  • 96.
  • 97.
  • 98.
  • 99.
  • 100.
  • 101.
  • 102.
  • 103.
  • 104.
  • 105.
  • 106.
  • 107.
  • 108.
  • 109. Login shell(PID 442) Parent( PID 512) Child(PID 513) Process group 512 Process group 442 Fork/exec session fork
  • 110.
  • 111.
  • 112.
  • 113.
  • 114.
  • 115.
  • 116.
  • 117.
  • 118.
  • 119.
  • 120.
  • 121.
  • 122.