Operating Systems. Review ENCE 360

Similar documents
Processes COMPSCI 386

3.1 Introduction. Computers perform operations concurrently

W4118 Operating Systems. Junfeng Yang

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

Process Management 1

CPS 310 first midterm exam, 2/26/2014

Inter-Process Communication

SMD149 - Operating Systems

Processes and Threads

Unix Processes. What is a Process?

Operating System Labs. Yuanbin Wu

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

Problem Set: Processes

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

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

What Is A Process? Process States. Process Concept. Process Control Block (PCB) Process State Transition Diagram 9/6/2013. Process Fundamentals

Operating System Design

CMPSCI 377: Operating Systems Exam 1: Processes, Threads, CPU Scheduling and Synchronization. October 9, 2002

Chapter 3: Processes. Operating System Concepts 9 th Edit9on

Process Management! Goals of this Lecture!

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

Prepared by Prof. Hui Jiang Process. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University

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

Process. Prepared by Prof. Hui Jiang Dept. of EECS, York Univ. 1. Process in Memory (I) PROCESS. Process. How OS manages CPU usage? No.

Processes and Non-Preemptive Scheduling. Otto J. Anshus

CS 326: Operating Systems. Process Execution. Lecture 5

Problem Set: Processes

CHAPTER 3 - PROCESS CONCEPT

Operating Systems. CPU Scheduling ENCE 360

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

Chapter 4: Multithreaded Programming

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

W4118: OS Overview. Junfeng Yang

Process Description and Control

csci3411: Operating Systems

Chapter 3: Processes. Operating System Concepts 9 th Edition

Processes. CS439: Principles of Computer Systems January 30, 2019

Noorul Islam College Of Engineering, Kumaracoil MCA Degree Model Examination (October 2007) 5 th Semester MC1642 UNIX Internals 2 mark Questions

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

Notice: This set of slides is based on the notes by Professor Perrone of Bucknell and the textbook authors Silberschatz, Galvin, and Gagne

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

CSI Module 2: Processes

Chapter 3: Processes

Operating System Concepts Ch. 3: Processes

Lecture 4: Memory Management & The Programming Interface

CISC2200 Threads Spring 2015

Diagram of Process State Process Control Block (PCB)

Process. Program Vs. process. During execution, the process may be in one of the following states

Operating Systems Comprehensive Exam. Spring Student ID # 3/20/2013

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo

Processes. Overview. Processes. Process Creation. Process Creation fork() Processes. CPU scheduling. Pål Halvorsen 21/9-2005

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

(In columns, of course.)

Chapter 3: Processes. Operating System Concepts 9 th Edition

OS COMPONENTS OVERVIEW OF UNIX FILE I/O. CS124 Operating Systems Fall , Lecture 2

Killing Zombies, Working, Sleeping, and Spawning Children

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

The Big Picture So Far. Chapter 4: Processes

Processes and Threads

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

Design Overview of the FreeBSD Kernel CIS 657

TDIU25: Operating Systems II. Processes, Threads and Scheduling

Chapter 3: Processes

CSC 539: Operating Systems Structure and Design. Spring 2006

Exam Guide COMPSCI 386

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

Maria Hybinette, UGA. ! One easy way to communicate is to use files. ! File descriptors. 3 Maria Hybinette, UGA. ! Simple example: who sort

University of Ottawa School of Information Technology and Engineering

CS 3733 Operating Systems

Chapter 4: Threads. Operating System Concepts. Silberschatz, Galvin and Gagne

The Big Picture So Far. Chapter 4: Processes

Midterm Exam CPS 210: Operating Systems Spring 2013

Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2

Chapter 3: Process Concept

Chapter 3 Processes. Process Concept. Process Concept. Process Concept (Cont.) Process Concept (Cont.) Process Concept (Cont.)

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

Chapter 3: Process Concept

Chapter 3: Process Concept

Getting to know you. Anatomy of a Process. Processes. Of Programs and Processes

Chapter 3: Processes. Operating System Concepts Essentials 2 nd Edition

Operating Systems Comprehensive Exam. Spring Student ID # 3/16/2006

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

CS 43: Computer Networks. 07: Concurrency and Non-blocking I/O Sep 17, 2018

Processes. CS439: Principles of Computer Systems January 24, 2018

Chapter 3: Process Concept

CHAPTER 2: PROCESS MANAGEMENT

PROCESS CONCEPTS. Process Concept Relationship to a Program What is a Process? Process Lifecycle Process Management Inter-Process Communication 2.

Process Management! Goals of this Lecture!

CSC 4320 Test 1 Spring 2017

Processes and Exceptions

Process. Operating Systems (Fall/Winter 2018) Yajin Zhou ( Zhejiang University

Process Time. Steven M. Bellovin January 25,

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Processes and threads

Lecture 2 Process Management

4. Concurrency via Threads

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

Agenda. Threads. Single and Multi-threaded Processes. What is Thread. CSCI 444/544 Operating Systems Fall 2008

Windows architecture. user. mode. Env. subsystems. Executive. Device drivers Kernel. kernel. mode HAL. Hardware. Process B. Process C.

OPERATING SYSTEMS. UNIT II Sections A, B & D. An operating system executes a variety of programs:

Mid Term from Feb-2005 to Nov 2012 CS604- Operating System

Transcription:

Operating Systems Review ENCE 360

High level Concepts What are three conceptual pieces fundamental to operating systems?

High level Concepts What are three conceptual pieces fundamental to operating systems? 1. Virtualization sharing computer hardware in time and space 2. Concurrency simultaneous access to shared resources 3. Persistence making information exist across power outages, crashes, etc.

Operating System Model Arrange layers in order, top (user) to bottom A. Device driver (e.g., mouse) B. Computer game (e.g., FIFA 2018) C. Shell (e.g., Bash) D. Physical devices (e.g., Hard disk) E. Operating System (e.g., Linux) F. Program control (e.g., Task Manager)

Operating System Model Arrange layers in order, top (user) to bottom Music App Web Browser Game Applications Task Manager Shell Shell System Programs Operating System Device Driver A Device Driver B Device Driver C Hardware Physical Devices

What is a process? The Process

The Process What is a process? A program in execution

Process States What are the 3 main process states? What are the transitions between them?

Process States What are the 3 main process states? What are the transitions between them? Clean up Initialization Running Terminate Create Dispatch Interrupt I/O request Ready I/O complete Waiting

Process Control Block What is a process control block? What are the main components?

Process Control Block What is a process control block? A data structure the OS uses to manage a running program (a process) What are the main components? Running current code stuff PC, registers, state, Memory stuff stack, heap, code, I/O stuff file descriptors, working directory,

Process Creation in Unix main() { fork(); puts( hello ); } What does the code to the left do when run? How can we change it to only have child process print hello?

Process Creation in Unix main() { fork(); puts( hello ); } What does the code to the left do when run? hello hello How can we change it to only have child process print hello? Change fork() line to be: if (fork() == 0)

Processes and Threads What is a process? What is a thread? For two processes, what is private? For two threads in the same process, what is private?

Processes and Threads What is a process? A program in execution / a running program What is a thread? A single sequence of execution within a process For two processes, what is private? Code, memory (global variables, stack), hardware state (program counter, registers), OS resources (file descriptors+) For two threads in the same process, what is private? Memory (stack), Hardware state (program counter, registers)

Processes and Threads For two processes, what is private? For two threads in the same process, what is private? (Helpful picture)

Thread Creation with Pthreads void A() { puts( hello ); } What does the code to the left do when run? void main() { pthread_create(&t,a); puts( goodbye ); }

Thread Creation with Pthreads void A() { puts( hello ); } void main() { pthread_create(&t,a); puts( goodbye ); } What does the code to the left do when run? goodbye or hello hello goodbye What code to add to always have hello before goodbye?

Thread Creation with Pthreads void A() { puts( hello ); } void main() { pthread_create(&t,a); pthread_join(t); puts( goodbye ); } What does the code to the left do when run? goodbye or hello or goodbye hello goodbye What code to add to always have hello before goodbye? pthread_join(t) before puts( goodbye )

IPC Paradigms What are two main paradigms for Interprocess Communication (IPC)? What are some advantages/disadvantages for each?

IPC Paradigms What are two main paradigms for Interprocess Communication (IPC)? What are some advantages/disadvantages for each? 1. Message passing Good: explicit, less chance for programmer error Bad: overhead 2. Shared memory Good: performance, flexibility for programmer Bad: changes without process knowing (side effects), programmer needs to handle sync

IPC Mechanisms What are some IPC mechanisms?

IPC Mechanisms What are some IPC mechanisms? Pipe Files Shared memory Signals Sockets

Pipe What is a pipe? What operations does it support?

Pipe What is a pipe? What operations does it support? IPC mechanism provided by OS Gives bounded buffer, FIFO/queue access Write to one end, Read from other Block on full write, Block on empty read b l a h. c \0 read fd write fd

System Exploration File descriptors and exec() Signal signal Thread signal Challenge: once you use dup2() to change STDOUT, can you restore it? Hint, see: https://stackoverflow.com/questions/11042218/crestore stdout to terminal

Dup2 From the user s perspective, what does this code do? fd = open( dup.txt, O_WRONLY) dup2(fd, STDOUT_FILENO) What does it do from the system s perspective?

Dup2 From the user s perspective, what does this code do? fd = open( dup.txt, O_WRONLY) dup2(fd, STDOUT_FILENO) Opens a file and changes standard output to go to the file instead of the screen What does it do from the system s perspective? Closes STDOUT_FILENO, copies the file descriptor to the new file descriptor 0 1 stdout 2 3 file... Before dup2() 0 1 stdout 2 3 file... After dup2()

Signals What is an operating system signal? Broadly describe how to write code to use one Provide an example of how signals might be used

Signals What is an operating system signal? A message to a process corresponding to an event, sent by either another process or the OS Broadly describe how to write code to use one Provide an example of how signals might be used

Signals What is an operating system signal? A message to a process corresponding to an event, sent by either another process or the OS Broadly describe how to write code to use one Write handler function Make system call Send signals Provide an example of how signals might be used

Signals What is an operating system signal? A message to a process corresponding to an event, sent by either another process or the OS Broadly describe how to write code to use one Write handler function Make system call Send signals Provide an example of how signals might be used Gracefully shut down upon ctrl c Indicate to parent child has finished work Wake up and do some action upon an alarm

Sockets What two (maybe three) pieces of information does a client need to know to connect to a server?

Sockets What two (maybe three) pieces of information does a client need to know to connect to a server? IP Address gets data to right computer Port gets data to right process (Network protocol TCP or UDP) socket any port agreed port socket client Internet address = 138.37.94.248 message other ports server Internet address = 138.37.88.249

Sockets Put in Order for Client & Server send() connect() bind() close() recv() accept() listen() socket() Client Server

Sockets Put in Order for Client & Server send() connect() bind() close() recv() accept() listen() socket() Client socket() connect() send() recv() close() Server socket() bind() listen() accept() recv() close()

Sockets Describe What is the difference between send() and recv() vs. read() and write()

Sockets Describe What is the difference between send() and recv() vs. read() and write() Answer: send() and recv() have flags that may be useful E.g., MSG_PEEK, MSG_DONTWAIT

Sockets Describe What does non blocking mean for a socket?

Sockets Describe What does non blocking mean for a socket? Answer: recv()/send(), do not sleep if no data. Note: can be done for accept() too on server

CPU Scheduling Briefly describe the shortest time to completion first (STCF) algorithm Is STCF pre emptive?

CPU Scheduling Briefly describe the shortest time to completion first (STCF) algorithm From ready to run processes, select process with shortest time to finish it s CPU burst Is SCTF pre emptive? Yes if a process arrives that has a shorter completion time than the one currently running, it is chosen instead

CPU Scheduling Describe some rules that will make the MLFQ adaptive

CPU Scheduling Describe some rules that will make the MLFQ adaptive 1. New processes at highest priority 2. If process uses all of timeslice, reduce priority 3. If process voluntarily blocks before timeslice expires, increase priority