ECE344-Lecture11-Unix - Lecture 11: Unix System Calls and...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Lecture 11: Unix System Calls and Posix Threads David Lie ECE344 University of Toronto
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 ECE344: Operating Systems Overview Process-related Unix system calls Posix threads
Background image of page 2
3 ECE344: Operating Systems Process-related Unix System Calls Unix provides process-related system calls for: – Identifying processes: getpid(), getppid() – Creating processes: fork(), execv() – Terminating processes: exit(), wait() – Signaling processes: kill(), sigaction()
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 ECE344: Operating Systems Identifying Processes Recall a process is an address space that has one thread associated with it – Each process has a unique ID called PID – PID identifies both address space and thread – PID is obtained via getpid() system call Each process has a parent associated with it – The parent’s PID is obtained via getppid() system call stack text data SP PC
Background image of page 4
5 ECE344: Operating Systems Creating Processes fork() system call creates a new process – The original process is called the parent process – The new process is called the child of the parent process fork() copies the parent’s thread state and address space to the child’s thread state and address space – Processor registers, code, data, stack regions are copied As a result, after fork() returns, both parent and child start executing the instruction after the fork() call! – To distinguish the two processes, fork() returns PID of child
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 02/20/2012.

Page1 / 17

ECE344-Lecture11-Unix - Lecture 11: Unix System Calls and...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online