1 CMSC421: Principles of Operating Systems Nilanjan Banerjee Principles of Operating Systems Assistant Professor, University of Maryland Baltimore County.

Slides:



Advertisements
Similar presentations
Processes Management.
Advertisements

©2009 Operačné systémy Procesy. 3.2 ©2009 Operačné systémy Process in Memory.
Dr. Kalpakis CMSC 421, Operating Systems. Fall Processes.
1 CMSC421: Principles of Operating Systems Nilanjan Banerjee Principles of Operating Systems Assistant Professor, University of Maryland Baltimore County.
Abhinav Kamra Computer Science, Columbia University 4.1 Operating System Concepts Silberschatz, Galvin and Gagne  2002 Chapter 4: Processes Process Concept.
Modified from Silberschatz, Galvin and Gagne ©2009 Lecture 6 Chapter 4: Threads.
Chapter 3: Processes.
Chapter 3 Processes.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 3: Processes.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Chapter 3: Processes Process Concept.
1/30/2004CSCI 315 Operating Systems Design1 Processes Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating.
Chapter 3: Processes. Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Chapter 3: Processes Process Concept.
Modified from Silberschatz, Galvin and Gagne ©2009 CS 446/646 Principles of Operating Systems Lecture 5 Chapter 3: Processes (cont)
Interprocess Communication. Process Concepts Last class.
Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server Systems.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 3: Processes.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 3: Processes.
1 CMSC421: Principles of Operating Systems Nilanjan Banerjee Principles of Operating Systems Assistant Professor, University of Maryland Baltimore County.
1 CMSC421: Principles of Operating Systems Nilanjan Banerjee Principles of Operating Systems Acknowledgments: Some of the slides are adapted from Prof.
AE4B33OSS Chapter 3: Processes. 3.2Silberschatz, Galvin and Gagne ©2005AE4B33OSS Chapter 3: Processes Process Concept Process Scheduling Operations on.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 3: Processes Process Concept Process Scheduling.
3.1 Silberschatz, Galvin and Gagne ©2009Operating System Concepts with Java – 8 th Edition Chapter 3: Processes.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Outline n Process Concept n Process.
Chapter 3: Processes (6 th edition chap 4). 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
1 11/1/2015 Chapter 4: Processes l Process Concept l Process Scheduling l Operations on Processes l Cooperating Processes l Interprocess Communication.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 3: Processes.
Processes © Sekolah Tinggi Teknik Surabaya 1. » Process Concept » Process Scheduling » Operations on Processes » Interprocess Communication » Examples.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process Concept.
Processes CSCI 4534 Chapter 4. Introduction Early computer systems allowed one program to be executed at a time –The program had complete control of the.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 3 Operating Systems.
Chapter 3: Process-Concept. Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication.
3.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 3: Process Concept.
3.1 Silberschatz, Galvin and Gagne ©2009Operating System Concepts with Java – 8 th Edition Chapter 3: Processes.
3.1 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Overview: Process Concept Process Scheduling Operations on Processes.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Jan 19, 2005 Chapter 3: Processes Process Concept.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 3: Processes.
Chapter 3: Processes-Concept. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes-Concept Overview Process Scheduling.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 3: Processes.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
InterProcess Communication. Interprocess Communication Processes within a system may be independent or cooperating Cooperating process can affect or be.
 Process Concept  Process Scheduling  Operations on Processes  Cooperating Processes  Interprocess Communication  Communication in Client-Server.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
3.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Objectives To introduce the notion of a process -- a program in execution,
Chapter 3: Process-Concept. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Chapter 3: Process-Concept Process Concept Process Scheduling.
3.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Process Termination Process executes last statement and asks the operating.
4.1 Operating System Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Chapter 3: Processes Process Concept.
Chapter 3: Processes.
CMSC621: Advanced Operating Systems Advanced Operating Systems
Chapter 3: Process Concept
Processes Overview: Process Concept Process Scheduling
Chapter 3: Processes.
Chapter 3: Processes.
Chapter 4: Processes Process Concept Process Scheduling
Chapter 3: Processes.
Chapter 3: Processes.
Chapter 3: Processes.
Chapter 3: Processes.
Chapter 3: Processes.
Chapter 3: Processes.
Chapter 3: Processes.
Chapter 3: Processes.
Presentation transcript:

1 CMSC421: Principles of Operating Systems Nilanjan Banerjee Principles of Operating Systems Assistant Professor, University of Maryland Baltimore County

2 Announcements Readings from Silberchatz [3 nd chapter] Project 1 is out Homework 2 would be out next week

3 Process Context Switch n 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. n Context of a process represented in the PCB n Context-switch time is overhead; the system does no useful work while switching l The more complex the OS and the PCB -> longer the context switch n Time dependent on hardware support l Some hardware provides multiple sets of registers per CPU -> multiple contexts loaded at once

4 Process Context Switch

5 Process Scheduling

6 Process Queues

7 Lets take a kernel dive to study the process data structure and fork() system call Schedule child process duplicate task_struct

8 Inter-process communication Processes within a system may be independent or cooperating Cooperating process can affect or be affected by other processes, including sharing data Reasons for cooperating processes: –Information sharing –Computation speedup –Convenience Cooperating processes need interprocess communication (IPC)

9 IPC mechanisms Pipes (unidirectional) –Anonymous pipes (we have seen this) –Named pipes (FIFOs) (communication between processes that are not child and parent) (makes use of semaphores) Shared memory –Share a chunk of memory for read/write between processes Mmaped files –Communication through a file mapped to memory Message passing –Network sockets Signals –Slightly weird way of IPC

10 Pipes (unidirectional data transfer) Anonymous pipes –Defined within a process –Communication between parent and child processes Named pipes (FIFO) –Allows communication between processes which are not child/parent –Linux utilty: mkfifo

11 mkfifo int retval = mkfifo(“path to the pipe”, permissions ) –Creates a pipe –Use this pipe for reading writing, just like a file int fid = open(“path to file”, O_RDWR); use read(fid, char *, length) and write(fid, char *, length) to read and write from the pipe

12 Shared memory – Linux utilty: shmget, shmat, shmdt Page table Shared memory Process 1 Process 2 physical memory

13 Shared memory POSIX Shared Memory –Process first creates shared memory segment segment id = shmget(IPC PRIVATE, size, S IRUSR | S IWUSR); –Process wanting access to that shared memory must attach to it shared memory = (char *) shmat(id, NULL, 0); –Now the process could write to the shared memory sprintf(shared memory, "Writing to shared memory"); –When done a process can detach the shared memory from its address space shmdt(shared memory);

14 Memory mapped files (awesome hack!) Linux utility –mmap() File on disk Page cache File pages cached in memory Page table Process 1 Process 2

15 Mmap() First create a file of all zeros dd if=/dev/zero of=“your file” bs=1024 count = 1024 –Creates a file of size 1M Open that file Memory map that file –mmap(start_addr, length, protocol (PROT_READ|PROT_WRITE), flags (MAP_SHARED),, offset) –Returns a pointer to read and write from the mmaped region

16 POSIX Signals Linux kernel Process 1Process 2 Register a signal deliver a signal  NameDescriptionDefault Action SIGINT Interrupt character typedterminate process SIGQUIT Quit character typed ( ^\ )create core image SIGKILLkill -9 terminate process SIGSEGV Invalid memory referencecreate core image SIGPIPE Write on pipe but no reader terminate process SIGALRMalarm() clock ‘rings’terminate process SIGUSR1 user-defined signal typeterminate process SIGUSR2 user-defined signal typeterminate process

17 signals int kill( pid_t pid, int signo ); –Send a signal to a process with a process id signal(, ) –Handle a maskable signal in your code

18 Message Passing Using Sockets A socket is defined as an endpoint for communication Concatenation of IP address and port The socket :1625 refers to port 1625 on host Communication consists between a pair of sockets

19 Message Passing Using Sockets

20 Concept of Remote Procedure calls n Remote procedure call (RPC) abstracts procedure calls between processes on networked systems n Stubs – client-side proxy for the actual procedure on the server n The client-side stub locates the server and marshalls the parameters n The server-side stub receives this message, unpacks the marshalled parameters, and performs the procedure on the server

Execution of RPC

22 An in-class discussion