Process. Discussion session 3 1/30/2016

Similar documents
Major Requirements of an OS

Operating System Control Structures

Process Description and Control. Major Requirements of an Operating System

Major Requirements of an Operating System Process Description and Control

Process Description and Control

Process Description and Control. Chapter 3

Operating Systems. Lecture 3- Process Description and Control. Masood Niazi Torshiz

Process Description and Control

IT 540 Operating Systems ECE519 Advanced Operating Systems

Process Description and Control. Chapter 3

Dr. D. M. Akbar Hussain DE5 Department of Electronic Systems

Processes. Process Management Chapter 3. When does a process gets created? When does a process gets terminated?

Announcement. Exercise #2 will be out today. Due date is next Monday

Today s class. Finish review of C Process description and control. Informationsteknologi. Tuesday, September 18, 2007

Process Description and Control

Process Description and Control. Chapter 3

Processes. OS Structure. OS Structure. Modes of Execution. Typical Functions of an OS Kernel. Non-Kernel OS. COMP755 Advanced Operating Systems

Chapter 3 Process Description and Control

B.H.GARDI COLLEGE OF MASTER OF COMPUTER APPLICATION. Ch-3 Process Description and Control

System Call. Preview. System Call. System Call. System Call 9/7/2018

Processes. Processes and Process Management. What is a Process? What is a Process? What is a Process? Program Process

Introduction to Processes in Computer Systems SEEM

PROCESS CONTROL BLOCK TWO-STATE MODEL (CONT D)

Multiprogramming. Evolution of OS. Today. Comp 104: Operating Systems Concepts 28/01/2013. Processes Management Scheduling & Resource Allocation

Processes and Threads

Processes. Sanzheng Qiao. December, Department of Computing and Software

Process Concepts. CSC400 - Operating Systems. 3. Process Concepts. J. Sumey

Chapter 3 Process Description and Control

Process a program in execution; process execution must progress in sequential fashion. Operating Systems

3.1 Introduction. Computers perform operations concurrently

Processes. Dr. Yingwu Zhu

Process Description and Control

Why use an Operating System? Operating System Definition

Operating Systems Process description and control

Roadmap. Tevfik Ko!ar. CSC Operating Systems Fall Lecture - III Processes. Louisiana State University. Processes. September 1 st, 2009

THE PROCESS ABSTRACTION. CS124 Operating Systems Winter , Lecture 7

Learning Outcomes. Processes and Threads. Major Requirements of an Operating System. Processes and Threads

Announcements. Reading. Project #1 due in 1 week at 5:00 pm Scheduling Chapter 6 (6 th ed) or Chapter 5 (8 th ed) CMSC 412 S14 (lect 5)

آنستیتیوت تکنالوجی معلوماتی و مخابراتی ICTI

Lecture Topics. Announcements. Today: Operating System Overview (Stallings, chapter , ) Next: Processes (Stallings, chapter

Processes and Threads. Processes and Threads. Processes (2) Processes (1)

Part V. Process Management. Sadeghi, Cubaleska RUB Course Operating System Security Memory Management and Protection

OPERATING SYSTEM. The Process. Introduction Process creation & termination Process state diagram Process scheduling & its criteria

Processes and Threads

Lecture 3: Processes. CMPUT 379, Section A1, Winter 2014 January 13, 15 and 17

OPERATING SYSTEM SUPPORT (Part 1)

Chapter 3: Processes. Operating System Concepts 8th Edition,

CS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017

Processes and Non-Preemptive Scheduling. Otto J. Anshus

CS510 Operating System Foundations. Jonathan Walpole

CS 31: Intro to Systems Processes. Kevin Webb Swarthmore College March 31, 2016

Processes, PCB, Context Switch

Process Concepts 8/21/2014. CS341: Operating System. Scheduling: Theoretical Analysis

Computer Systems II. First Two Major Computer System Evolution Steps

Course Syllabus. Operating Systems, Spring 2016, Meni Adler, Danny Hendler & Amnon Meisels

Processes Prof. James L. Frankel Harvard University. Version of 6:16 PM 10-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved.

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo

Wednesday, September 14, Chapter 3: Processes

CPSC 341 OS & Networks. Processes. Dr. Yingwu Zhu

Main Points of the Computer Organization and System Software Module

Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

PROCESSES Gursharan Singh Tatla 24/01/2011

REVIEW OF COMMONLY USED DATA STRUCTURES IN OS

Processes The Process Model. Chapter 2. Processes and Threads. Process Termination. Process Creation

! The Process Control Block (PCB) " is included in the context,

Processes The Process Model. Chapter 2 Processes and Threads. Process Termination. Process States (1) Process Hierarchies

Introduction to OS Processes in Unix, Linux, and Windows MOS 2.1 Mahmoud El-Gayyar

Processes. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Chap 4, 5: Process. Dongkun Shin, SKKU

CSC 539: Operating Systems Structure and Design. Spring 2006

SMD149 - Operating Systems


Killing Zombies, Working, Sleeping, and Spawning Children

1 PROCESSES PROCESS CONCEPT The Process Process State Process Control Block 5

Processes. CS 416: Operating Systems Design, Spring 2011 Department of Computer Science Rutgers University

Processes and More. CSCI 315 Operating Systems Design Department of Computer Science

Chapter 3: Processes. Operating System Concepts 8 th Edition,

Process Concept. Minsoo Ryu. Real-Time Computing and Communications Lab. Hanyang University.

2 Processes. 2 Processes. 2 Processes. 2.1 The Process Model. 2.1 The Process Model PROCESSES OPERATING SYSTEMS

Lecture Topics. Announcements. Today: Threads (Stallings, chapter , 4.6) Next: Concurrency (Stallings, chapter , 5.

Following are a few basic questions that cover the essentials of OS:

Process Time. Steven M. Bellovin January 25,

B. V. Patel Institute of Business Management, Computer &Information Technology, UTU

Operating System. Chapter 3. Process. Lynn Choi School of Electrical Engineering

Operating Systems Overview. Chapter 2

CSCE Introduction to Computer Systems Spring 2019

CSCI 447 Operating Systems Filip Jagodzinski

OS Main Goals. 10/24/2013 Operating Systems, Beykent University 1

csci3411: Operating Systems

Inter-Process Communication and Synchronization of Processes, Threads and Tasks: Lesson-1: PROCESS

Processes & Threads. Today. Next Time. ! Process concept! Process model! Implementing processes! Multiprocessing once again. ! More of the same J

Chapter 3: Process Concept

Chapter 3: Process Concept

Introduction to Process in Computing Systems SEEM

Subject: Operating System (BTCOC403) Class: S.Y.B.Tech. (Computer Engineering)

Chapter 3: Process Concept

Lecture 4: Mechanism of process execution. Mythili Vutukuru IIT Bombay

Chapter 3: Processes

Operating Systems. Computer Science & Information Technology (CS) Rank under AIR 100

Transcription:

Process Discussion session 3 1/30/2016

A program in execution What is the process? An instance of a program running on a computer The entity can be assigned to and executed on a processor A unit of activity characterized by the execution of a sequence of instructions, a current state, and an associated set of system instructions.

Process Model Multiprogramming of four programs Conceptual model of four independent, sequential processes Only one program active at any instant.

Process states Running : executing Blocked: waiting for I/O Ready: waiting to be scheduled. 1:process blocks for input 2:scheduler picks another process 3:scheduler picks this process 4:input becomes available.

Main OS process-related goals Interleave the execution of existing processes to maximize processor utilization Provide reasonable response times Allocate resources to processes Support inter-process communication (and synchronization) and user creation of processes

How are these goals achieved? Schedule and dispatch processes for execution by the processor Implement a safe and fair policy for resource allocation to processes Respond to requests by user programs Construct and maintain tables for each process managed by the operating system

When is a new process created? System Initialization(Daemons) Execution of a process creation system call by a running process A user request to create a process Initiation of a batch job

When does a process terminate? Normal exit(voluntary) Error exit(voluntary) Fatal error(involuntary) Killed by another process(involuntary)

Process snapshot StackS Free space Dynamic data Static data Code PSW Stack pointer Program Counter Virtual memory

Process elements While the program is executing, this process can be uniquely characterized by a number of elements, including: identifier state priority program counter memory pointers context data I/O status information accounting information

Process Table Collection of process descriptors for each task/process Each entry contains: process identification() Process ID, Parent s ID, Children ID and Owner s ID. pointers to the Process Control Block (PCB) and process image for each process PCB Collection of attributes for managing the process Process image Collection of program, data (modifiable part), stack, and data stored in PCB A process may be linked to other processes which are related (e.g. children, parent)

Process Control Block(PCB) PID,PPID and User s ID Identifiers Process State Information User-Visible Registers Typically, 16 to 32 registers that can be referenced by user programs directly Control and Status registers Program counter: contains the address of next instruction Condition codes: result of the most recent arithmetic or logical operation Status information: interrupt enabled/disabled flags, execution mode,etc. Stack pointers: each process has one or more LIFO system stacks which is used to store parameters and calling addresses for procedure and system calls.

Process Control Block(cont.) Process Control Information Scheduling and state information(needed by the OS to perform its scheduling function): Process state: (e.g., running, ready, waiting/blocked, halted). Priority: scheduling the priority of the process. Scheduling-related information: that the scheduling algorithm may need (e.g. the amount of time spent in waiting, the amount of time used during the last time it was running, etc.) Event: Id of event the process is awaiting before it can run again Data structuring: A process may be linked to other processes in a queue, ring, or some other structure. For example, all processes in a waiting state for a particular priority level may be linked in a queue. A process may exhibit a parent-child (creator-created) relationship with another process. The PCB may contain pointers to other processes to support these structures.

Process control block(cont.) Interprocess communication info Various flags, signals, and messages associated with communication between processes. Process privileges Processes are granted privileges in terms of the memory that may be accessed, the types of instructions that may be executed, the system utilities and services that may be used, etc. Memory management includes pointers to segment and/or page tables that describe the virtual memory assigned to this process. Resource ownership and utilization Resources controlled by the process such as opened files. A history of utilization of the processor or other resources may also be included (may be needed by the scheduler)

Process Creation Assign a unique process identifier(pid) Allocate space for the process. Initialize process control block. Set up appropriate linkages. Ex: add new process to linked list (i.e. queue) used for scheduling When to Switch a Process Clock interrupt I/O interrupt Memory(page) fault The address referenced is not in main memory so it must be brought into main memory Trap When an error occurred. May cause process to move to the Exit state.

Execution within user processes Process Identification Processor State Information Process Control Information Process Control Block User Stack Private User Address Space (Programs, Data) Kernel Stack Shared Address Space Figure 3.16 Process Image: Operating System Executes Within User Space

Mode Switching If no interrupts are pending the processor: If an interrupt is pending the processor: proceeds to the fetch stage and fetches the next instruction of the current program in the current process sets the program counter to the starting address of an interrupt handler program switches from user mode to kernel mode so that the interrupt processing code may include privileged instructions

Change of process state The steps in a full process switch are: If the currently running process is to be moved to another state (Ready, Blocked, etc.), then the OS must make substantial changes in its environment save the context of the processor update the process control block of the process currently in the Running state move the process control block of this process to the appropriate queue select another process for execution restore the context of the processor to that which existed at the time the selected process was last switched out update memory management data structures update the process control block of the process selected

Change of process state Save context of processor including program counter and other registers Update the PCB of the process that stopped running Move PCB to an appropriate queue - ready, blocked, etc. Select another process for execution Update the PCB of the process selected (e.g. change state to running) Restore context of the selected process CPU Process Descriptor X Process Descriptor Y

Exercise 2 Modifying the Process Table

The Process Table Minix has two process tables: proc & mproc proc: kernel data structure mproc: userland data structure The two are kept in sync by the kernel The mproc table is used to generate procfs

Tasks 1. Add a new pid_t field to struct mproc in servers/pm/mproc.h 2. Modify servers/pm/forkexit.c to set the new field to double the value of the pid Look at do_fork() and do_srv_fork() 3. Modify servers/procfs/pid.c to output the value Look at pid_psinfo(int i) 4. Recompile, install, and reboot

Submission On Canvas, Submit a screenshot of the two results of e.g. cat /proc/<id>/psinfo cat /proc/108/psinfo cat /proc/142/psinfo There should be a visible field equal to 2 * <id> Deadline: Monday 2pts Tuesday 1pt