EECE.4810/EECE.5730 Operating Systems

Slides:



Advertisements
Similar presentations
3.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Process An operating system executes a variety of programs: Batch system.
Advertisements

Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
CMPT 300: Operating Systems I Ch 3: Processes Dr. Mohamed Hefeeda
CSSE Operating Systems
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Process Management. Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication.
Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication in Client-Server.
Introduction to Processes CS Intoduction to Operating Systems.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-1 Process Concepts Department of Computer Science and Software.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
ITEC 502 컴퓨터 시스템 및 실습 Chapter 2-1: Process Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Computer Studies (AL) Operating System Process Management - Process.
Processes – Part I Processes – Part I. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Review on OSs Upon brief introduction of OSs,
System calls for Process management
CS212: OPERATING SYSTEM Lecture 2: Process 1. Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Linux Processes Travis Willey Jeff Mihalik. What is a process? A process is a program in execution A process includes: –program counter –stack –data section.
1  process  process creation/termination  context  process control block (PCB)  context switch  5-state process model  process scheduling short/medium/long.
Lecture 4: Processes & Threads. Lecture 4 / Page 2AE4B33OSS Silberschatz, Galvin and Gagne ©2005 Contents The concept of Process Process states and life-cycle.
CSE Operating System Principles
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Tutorial 3. In this tutorial we’ll see Fork() and Exec() system calls.
System calls for Process management Process creation, termination, waiting.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
1 Module 3: Processes Reading: Chapter Next Module: –Inter-process Communication –Process Scheduling –Reading: Chapter 4.5, 6.1 – 6.3.
Operating System Components) These components reflect the services made available by the O.S. Process Management Memory Management I/O Device Management.
Lecture 3 Process.
Chapter 3: Processes.
Chapter 3: Process Concept
Topic 3 (Textbook - Chapter 3) Processes
Processes Chapter 3 These slides include text, figures, and information from Operating Systems Concepts, by Silberschatz, Galvin, and Gagne. They also.
Process Management Presented By Aditya Gupta Assistant Professor
Processes Overview: Process Concept Process Scheduling
Chapter 3: Process Concept
Chapter 3: Processes Source & Copyright: Operating System Concepts, Silberschatz, Galvin and Gagne.
Chapter 3: Processes.
Example questions… Can a shell kill itself? Can a shell within a shell kill the parent shell? What happens to background processes when you exit from.
System Structure and Process Model
Chapter 3: Processes.
System Structure and Process Model
Processes in Unix, Linux, and Windows
CGS 3763 Operating Systems Concepts Spring 2013
Lecture 2: Processes Part 1
EECE.4810/EECE.5730 Operating Systems
CGS 3763 Operating Systems Concepts Spring 2013
Processes in Unix, Linux, and Windows
System Structure and Process Model
CGS 3763 Operating Systems Concepts Spring 2013
Process & its States Lecture 5.
Chapter 3: Processes.
Operating System Concepts
Lab 5 Process Control Operating System Lab.
EECE.2160 ECE Application Programming
Chapter 3: Processes.
Processes in Unix, Linux, and Windows
EECE.2160 ECE Application Programming
Outline Chapter 2 (cont) Chapter 3: Processes Virtual machines
EECE.4810/EECE.5730 Operating Systems
Chapter 3: Process Concept
EECE.2160 ECE Application Programming
EECE.4810/EECE.5730 Operating Systems
EECE.4810/EECE.5730 Operating Systems
EECE.4810/EECE.5730 Operating Systems
EECE.4810/EECE.5730 Operating Systems
EECE.4810/EECE.5730 Operating Systems
EECE.4810/EECE.5730 Operating Systems
EECE.4810/EECE.5730 Operating Systems
Chapter 3: Process Management
Presentation transcript:

EECE.4810/EECE.5730 Operating Systems Instructor: Dr. Michael Geiger Spring 2019 Lecture 13 Exam 1 Preview

Operating Systems: Exam 1 Preview Lecture outline Announcements/reminders Program 2 still to be posted; due date TBD Exam 1: Monday, 2/25, 3-5 PM, Ball 214 Covers lectures through Wednesday Will be allowed two 8.5” x 11” double-sided note sheets No electronic devices, other notes allowed No Monday lecture; will be in office until ~2:45 PM Today’s lecture: Exam 1 preview Exam guidelines Review of relevant material 5/16/2019 Operating Systems: Exam 1 Preview

Operating Systems: Exam 1 Preview Exam 1 notes Allowed two 8.5” x 11” double-sided sheets of notes No other notes; no electronic devices (calculator, phone) Exam will last 2 hours—please be on time Covers lectures 2-12 4 questions, each with multiple parts Process management (creation, deletion, etc.) Inter-process communication General multithreading Synchronization Formats include short answer (i.e., explain concept) or problem-solving (i.e. 1 correct numeric answer) EECE.5730 students will have additional work on some problems 5/16/2019 Operating Systems: Exam 1 Preview

Operating Systems: Exam 1 Preview Test policies Prior to passing out exam, your instructor will verify that you only have two note sheets If you have >2 sheets, I will take all notes You will not be allowed to remove anything from your bag after you receive your exam If you need an additional pencil, eraser, or piece of scrap paper during the exam, ask me Only one person will be allowed to use the bathroom at a time You must leave your cell phone either with me or clearly visible on the table near your seat 5/16/2019 Operating Systems: Exam 1 Preview

Operating Systems: Exam 1 Preview Review: Processes Process: program in execution 1+ running pieces of code (threads) + everything code can read/write Program counter Registers Address space Address space: all code/data stored in memory Text section: code Data section: global variables Stack: temporary data related to functions Heap: dynamically allocated data 5/16/2019 Operating Systems: Exam 1 Preview

Operating Systems: Exam 1 Preview Review: Process State new: Process is being created running: Instructions are being executed waiting: Process waiting for some event to occur ready: Process waiting to be assigned to a processor terminated: Process has finished execution 5/16/2019 Operating Systems: Exam 1 Preview

Review: Process creation Each process has to be created by another process Creator is called parent process Created process is child process Children can create other processes, forming process tree Parent/child processes may share resources Parent/child processes may execute concurrently, or parent may wait for child to terminate 5/16/2019 Operating Systems: Exam 1 Preview

Review: Process creation (cont.) Address space Initially, child duplicate of parent Child can load a separate program 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 5/16/2019 Operating Systems: Exam 1 Preview

Review: more details on fork() and wait() fork() return value is: <0 if fork() fails (no child created) 0 within child process PID of child (>0) within parent process Can use to differentiate child from parent Run same program but use conditional statement to send parent/child down different paths wait() system call allows parent to wait for child to finish execution 5/16/2019 Operating Systems: Exam 1 Preview

Review: exec system calls To start new program, replace address space of current process with new process On UNIX systems, use exec system calls Family of functions allowing you to specify Location of executable execlp(), execvp() don’t require full path Command line arguments to executable, either as Separate strings passed to execl(), execle(), execlp() Array of strings passed to execv(), execve(), execvp() Optional list of new environment variables 5/16/2019 Operating Systems: Exam 1 Preview

Review: Forking Separate Process int main() { pid_t pid; pid = fork(); // Create a child process if (pid < 0) { // Error occurred fprintf(stderr, "Fork failed"); return 1; } else if (pid == 0) { // Child process printf("Child: listing of current directory\n\n"); execlp("/bin/ls", "ls", NULL); else { // Parent process—wait for child to complete printf("Parent: waits for child to complete\n\n"); wait(NULL); printf("Child complete\n\n"); return 0; 5/16/2019 Operating Systems: Exam 1 Preview

Review: Process Termination Process ends using exit() system call May be explicit, implicit (return from main  exit()) Returns status data from child to parent (via wait()) Process’ resources are deallocated by operating system Parent may abort() executing child process if: Child has exceeded allocated resources Task assigned to child is no longer required Parent exiting and OS does not allow child to continue if parent terminates Not true in Linux, for example OS initiates cascading termination 5/16/2019 Operating Systems: Exam 1 Preview

Review: Process Termination Parent may wait() for child termination wait() returns child PID, passes return status through pointer argument pid = wait(&status); If child terminates before parent invokes wait(), process is a zombie If parent terminated without wait() , process is an orphan Return status must be checked In Linux, orphans assigned init as parent 5/16/2019 Operating Systems: Exam 1 Preview

Review: Interprocess Communication Shared memory Communication largely process-managed after OS used to set up shared region Message passing OS responsible for send/receive primitives Direct communication: processes send messages directly to one another Indirect communication: processes send to/receive from mailboxes 5/16/2019 Operating Systems: Exam 1 Preview

Operating Systems: Exam 1 Preview Review: IPC Models (a) Message passing (b) Shared memory 5/16/2019 Operating Systems: Exam 1 Preview

Operating Systems: Exam 1 Preview Review: Threads Thread: active sequence of instructions Basic unit of CPU utilization Thread creation is lightweight Multiple threads in same process can share address space Each thread needs own PC, register copies, stack + SP Threads provide concurrency within application HW support necessary for parallelism Major issue: non-deterministic ordering Solutions require atomic operations Avoid race condition: solution depends on timing/ordering of earlier events 5/16/2019 Operating Systems: Exam 1 Preview

Review: Critical section Code section that needs to be run atomically with respect to selected other pieces of code A and B often same piece of code Protects access to shared resource Critical section requirements: Mutual exclusion: ≤1 thread executes CS at a time Progress: if >1 thread attempts CS at same time, 1 thread guaranteed to be selected Bounded waiting: if thread T requests access to its CS, limit on # times other threads can access their CS before T does 5/16/2019 Operating Systems: Exam 1 Preview

Operating Systems: Exam 1 Preview Review: Locks A lock (or mutex) prevents another thread from entering a critical section “Lock fridge while checking milk & shopping” Two operations: lock(): wait until lock is free, then acquire it do { if (lock is free) { // code in red acquire lock // is atomic break out of loop } } while (1); unlock(): release lock 5/16/2019 Operating Systems: Exam 1 Preview

Review: Condition variables Avoid busy waiting by enabling thread to sleep inside critical section by (steps in red are atomic): Release lock Put thread on waiting list Go to sleep After being woken, call lock() Each condition variable tracks list of threads waiting on that specific condition Each condition variable associated with lock 5/16/2019 Operating Systems: Exam 1 Preview

Review: Condition variable operations wait() Atomically release lock, add thread to waiting list, then go to sleep Thread must hold lock when calling wait() signal() Wake up one thread waiting on condition variable If no thread waiting, does nothing broadcast() Wake up all threads waiting on condition variable 5/16/2019 Operating Systems: Exam 1 Preview

Operating Systems: Exam 1 Preview Final notes Next time Exam 1—PLEASE BE ON TIME Reminders: Program 2 still to be posted; due date TBD Exam 1: Monday, 2/25, 3-5 PM, Ball 214 Covers lectures through Wednesday Will be allowed two 8.5” x 11” double-sided note sheets No electronic devices, other notes allowed No Monday lecture; will be in office until ~2:45 PM 5/16/2019 Operating Systems: Exam 1 Preview