Booting Up & Processes

Size: px
Start display at page:

Download "Booting Up & Processes"

Transcription

1 CS 326: Operating Systems Booting Up & Processes Lecture 3

2 Today s Schedule Booting the System Process Structure Process Execution The Init System fork() wait() 1/31/18 CS 326: Operating Systems 2

3 Today s Schedule Booting the System Process Structure Process Execution The Init System fork() wait() 1/31/18 CS 326: Operating Systems 3

4 Booting Up When you turn on your computer, it starts the boot process Named for pulling oneself over a fence by one's bootstraps Or in other words, doing the impossible Booting is a series of tasks that ultimately get the operating system running The first thing you (may) see is the POST Power-on Self Test 1/31/18 CS 326: Operating Systems 4

5 1/31/18 CS 326: Operating Systems 5

6 BIOS After initializing the hardware, your basic inputoutput system (BIOS) will start iterating through the disks connected to your machine When installing a new OS, you may change the boot order On a Mac, you can do this by holding down Option during boot (other machines: F12, Del ) Once a bootable disk is found, we proceed to the next boot phase 1/31/18 CS 326: Operating Systems 6

7 Master Boot Record The first 512 bytes on a hard drive contain the Master Boot Record (MBR) The MBR has two parts: Partition table Partition: segment of a disk Partition 1: Windows; Partition 2: Linux; etc. Boot code Responsible for continuing the boot process 1/31/18 CS 326: Operating Systems 7

8 Finding a Bootable Partition 1. The BIOS looks for a disk partition that ends with 0x55AA 2. Then it moves to address 0x7C00 and begins executing the instructions there 1/31/18 CS 326: Operating Systems 8

9 Hard-Coded Offsets You might be surprised that these offsets are just hard-coded into the system However, the BIOS is not particularly smart To make it smart would begin to resemble an OS The hardware should be as simple as possible Making it smart is very expensive! The software (OS) does not want to make many assumptions about the underlying hardware 1/31/18 CS 326: Operating Systems 9

10 Continuing the Boot Process We began executing instructions, so we re all done starting the OS, right? Unfortunately, no The first instructions executed are part of the bootloader The bootloader is a bit smarter than the BIOS, and handles the next steps in the boot process 1/31/18 CS 326: Operating Systems 10

11 Bootloader The bootloader can understand a variety of file systems Invent a new file system? Add support to the bootloader. No need to modify the hardware ROM It can also provide a list of operating systems available in a multi-boot configuration And it can handle larger disks! The BIOS is limited to a fixed number of partitions and disk sizes 1/31/18 CS 326: Operating Systems 11

12 Bootloaders Linux: grub, grub2, syslinux Windows: NTLDR, BOOTMGR macos: BootX FreeBSD: boot0 1/31/18 CS 326: Operating Systems 12

13 Installing a Bootloader Folks with multi-boot Windows + Linux machines may have come across some wise advice: When multi-booting, always install Linux last! This is because the bootloader (often grub) gets installed on the disk s shared MBR Grub can boot Linux, Windows, FreeBSD, etc The Windows bootloader only knows of the existence of Windows Installing it last means you have no way to boot Linux! 1/31/18 CS 326: Operating Systems 13

14 Bootloader Restrictions You can only have one bootloader per disk Installing one will overwrite another Luckily, you can always insert another disk (rescue CD, USB, etc) The Raspberry Pi has a very limited bootloader Can only read FAT partitions Expects a fixed set of configuration files and OS data 1/31/18 CS 326: Operating Systems 14

15 Boot Stages The bootloader is split into two stages: Stage 1 Stage 2 (appropriately named!) Stage 1 contains basic initialization code and is limited to a fixed size Stage 2 adds file system support, basic menus, and can read from the disk 1/31/18 CS 326: Operating Systems 15

16 Linux Stage 2 In Linux, the second stage is represented by an initial ramdisk (initrd) This contains a lightweight, compressed Linux system image The initrd is mounted in memory and contains a limited set of tools (called early user space ) This environment (finally!) sets up the OS for use Hardware initialization, mounting file systems, etc. 1/31/18 CS 326: Operating Systems 16

17 Finishing the Boot Process Once the boot process is complete, the very first process takes over Process: a running instance of a program PID 1, also known as init, takes care of launching the rest of the OS System services, startup tasks, etc 1/31/18 CS 326: Operating Systems 17

18 A Note about EFI Modern systems have extensible firmware interface (EFI) instead of BIOS EFI adds a lot of nice features and is smarter than the traditional BIOS Once nice aspect of EFI is the bootloader is no longer required! However, most OS still use a bootloader for additional flexibility 1/31/18 CS 326: Operating Systems 18

19 Today s Schedule Booting the System Process Structure Process Execution The Init System fork() wait() 1/31/18 CS 326: Operating Systems 19

20 From Program to Process When a program is executed, the OS reads its static data from the disk and copies it into main memory Program instructions, string literals, binary data A process ID (PID) is assigned Space is allocated for the stack and heap File descriptors are initialized stdout, stderr, stdin Run-time permissions are applied 1/31/18 CS 326: Operating Systems 20

21 Process Memory Layout 1/31/18 CS 326: Operating Systems 21

22 Virtual Memory Processes are given a zeroed out virtual address space rather than accessing main memory directly Prevents viewing/changing other process data Makes memory allocation and management simpler A page table lets the OS allocate blocks of noncontiguous memory on demand The memory management unit (MMU) handles translating virtual à physical addresses Supported by most CPUs 1/31/18 CS 326: Operating Systems 22

23 Communication While processes aren t allowed to manipulate memory directly, they can create pools of shared memory for communication However, there are often simpler methods to communicate: Signals, sockets, pipes, or even files Higher-level inter-process communication (IPC) frameworks allow event-based messaging and remote procedure calls 1/31/18 CS 326: Operating Systems 23

24 Inspecting the System While processes are limited to virtualized views of the hardware, they are still able to inspect it Memory, CPU, disk availability and usage Other process names and command lines Logged in users Hardware specs, serial numbers, etc. This is good, especially in shared environments! Overall, processes are a low-level abstraction 1/31/18 CS 326: Operating Systems 24

25 Inspecting the System w 23:11:06 up 1 day, 7:57, 11 users, load average: 16.07, 15.17, USER TTY LOGIN@ IDLE JCPU PCPU WHAT mal pts/0 07:16 14:37m 0.07s 0.07s -bash zoe pts/1 20:04 3:06m 0.43s 0.38s vim output/file-0 wash pts/2 23:00 4: s 0.05s vim Makefile inara pts/3 21:52 1:08m 0.82s 0.79s /usr/bin/python2 jayne pts/4 23: s 0.03s 0.03s -bash malensek pts/5 23: s 0.10s 0.04s w 1/31/18 CS 326: Operating Systems 25

26 Today s Schedule Booting the System Process Structure Process Execution The Init System fork() wait() 1/31/18 CS 326: Operating Systems 26

27 Basic Unit of Execution: Process The process is one of the most fundamental parts of any operating system A running instance of a program In the early days, only one process could run at once After all, we only have one CPU, right? Multitasking challenged this idea: why not let multiple processes share the CPU? 1/31/18 CS 326: Operating Systems 27

28 Multitasking In early multitasking systems, processes were responsible for yielding control of the CPU to others Once you are given control of the CPU, you can do whatever you want! As you can imagine, no process wanted to give up control of the CPU Buggy processes can also take control of the CPU and never give it up 1/31/18 CS 326: Operating Systems 28

29 CPU Virtualization Putting processes in control was messy and error prone not to mention complicated! A better approach turned out to be virtualizing the CPU Making each process think it has exclusive control over its very own CPU This led to preemptive multitasking Processes can be preempted swapped out at will by the OS 1/31/18 CS 326: Operating Systems 29

30 Concurrent Tasks Let s assume you want to listen to music and work on your CS 326 homework If you only have a single core, you need to switch between these two tasks quickly Switch too slow, and your music will skip Switch quickly enough, and the user will think things are all happening at the same time! Hundreds of processes run per second 1/31/18 CS 326: Operating Systems 30

31 Multitasking > Interrupt Safari, save Safari state < Load KernelThread state, execute KernelThread > Interrupt KernelThread, save KernelThread state < Load cmatrix state, execute cmatrix > Interrupt cmatrix, save cmatrix state < Load vim state, execute vim > Interrupt vim, save vim state < Load KernelThread state, execute KernelThread > Interrupt KernelThread, save KernelThread state < Load Safari state > Interrupt Safari, save Safari state 1/31/18 CS 326: Operating Systems 31

32 State Information The previous example introduced some new terms: State information Interrupts State information is stored in Process Control Blocks (PCBs) This includes, variables, call stack, heap, etc. Only one active PCB per CPU As a program runs, the OS may interrupt it to pause its execution 1/31/18 CS 326: Operating Systems 32

33 Anatomy: Process Control Block (Isolated from other processes) Call Stack Heap Permissions, ownership Isolate file access Environment Variables Register States Stack pointer, program counter Memory Addressing 1/31/18 CS 326: Operating Systems 33

34 The Scheduler The OS scheduler is responsible for ensuring each process gets a share of the CPU Rather than letting processes coordinate this, the scheduler preempts them Context switch Each process can pretend it owns the CPU When a process is waiting for an I/O device, it gets switched out until the operation completes Interleaves I/O and CPU usage 1/31/18 CS 326: Operating Systems 34

35 Scheduling Algorithms The OS scheduler is responsible for: Deciding which process gets to run Execution duration Scheduling frequency Different scheduling algorithms have different priorities Round robin scheduling: basic, fair, but does it provide good interactive performance? 1/31/18 CS 326: Operating Systems 35

36 Process State Transitions 1/31/18 CS 326: Operating Systems 36

37 Today s Schedule Booting the System Process Structure Process Execution The Init System fork() wait() 1/31/18 CS 326: Operating Systems 37

38 The First Process: PID 1 The very first process in a UNIX-like OS is called init Direct or indirect ancestor of all other processes Init is responsible for starting services, launching applications, rebooting/shutting down the system Specific init implementation can do more or less: System V Init, systemd, upstart, launchd, etc. You can even write your own! Boot Linux with flag: init=/path/to/your/init 1/31/18 CS 326: Operating Systems 38

39 Linux: init/main.c /* We try each of these until one succeeds. * The Bourne shell can be used instead of init if we are * trying to recover a really broken machine. */ if (execute_command) { ret = run_init_process(execute_command); if (!ret) return 0; panic("requested init %s failed (error %d).", execute_command, ret); } if (!try_to_run_init_process("/sbin/init")!try_to_run_init_process("/etc/init")!try_to_run_init_process("/bin/init")!try_to_run_init_process("/bin/sh")) return 0; panic("no working init found. Try passing init= option to kernel. " "See Linux Documentation/admin-guide/init.rst for guidance."); 1/31/18 CS 326: Operating Systems 39

40 Process Lineage ps -ef UID PID PPID C STIME TTY TIME CMD root Feb21? 00:00:57 /usr/lib/systemd/systemd root Feb21? 00:00:00 [kthreadd] root Feb21? 00:00:00 [ksoftirqd/0] root Feb21? 00:00:00 [kworker/0:0h] root Feb21? 00:01:21 [rcu_sched] root Feb21? 00:00:00 [rcu_bh] root Feb21? 00:00:13 [rcuos/0] root Feb21? 00:00:00 [rcuob/0] root Feb21? 00:00:00 [migration/0] root Feb21? 00:00:00 [lru-add-drain] root Feb21? 00:00:01 [watchdog/0]... malensek Feb21 tty1 00:00:00 login -- malensek malensek Feb21 tty1 00:00:00 bash 1/31/18 CS 326: Operating Systems 40

41 Init Responsibilities Some init systems may do more than others, but at a basic level they are responsible for one key task: Launching other processes When one process launches another, it is that process s parent The newly-launched process is the child Unfortunately there are no uncle or aunt processes 1/31/18 CS 326: Operating Systems 41

42 Creating Processes On Unix systems, we create processes with the fork system call Fork creates a duplicate (clone) of a running process Once the call to fork() is complete, the two processes run independently, moving on to the next instruction We can distinguish between the parent and child using the return value of the fork call Child: zero; Parent: non-zero 1/31/18 CS 326: Operating Systems 42

43 fork() example pid_t child = fork(); if (child == 0) { /* I am the child */ printf("child\n"); } else if (child == -1) { /* Something went wrong */ perror("fork"); } else { /* I am the parent */ printf("parent\n"); } 1/31/18 CS 326: Operating Systems 43

44 Waiting for Children A good parent will make sure its children finish their work, but it s not a requirement To do this, we can use the wait() system call Wait will block the parent until the specified child PID completes execution Does the init system wait on its children? 1/31/18 CS 326: Operating Systems 44

45 wait() example pid_t child = fork();... /* Parent code */ pid_t my_pid = getpid(); printf("parent (PID %d) waiting for child (PID %d)!\n", my_pid, child); wait(&child); 1/31/18 CS 326: Operating Systems 45

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017 ECE 550D Fundamentals of Computer Systems and Engineering Fall 2017 The Operating System (OS) Prof. John Board Duke University Slides are derived from work by Profs. Tyler Bletsch and Andrew Hilton (Duke)

More information

CS 326: Operating Systems. Process Execution. Lecture 5

CS 326: Operating Systems. Process Execution. Lecture 5 CS 326: Operating Systems Process Execution Lecture 5 Today s Schedule Process Creation Threads Limited Direct Execution Basic Scheduling 2/5/18 CS 326: Operating Systems 2 Today s Schedule Process Creation

More information

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

Lecture Topics. Announcements. Today: Threads (Stallings, chapter , 4.6) Next: Concurrency (Stallings, chapter , 5. Lecture Topics Today: Threads (Stallings, chapter 4.1-4.3, 4.6) Next: Concurrency (Stallings, chapter 5.1-5.4, 5.7) 1 Announcements Make tutorial Self-Study Exercise #4 Project #2 (due 9/20) Project #3

More information

Process Management! Goals of this Lecture!

Process Management! Goals of this Lecture! Process Management! 1 Goals of this Lecture! Help you learn about:" Creating new processes" Programmatically redirecting stdin, stdout, and stderr" (Appendix) communication between processes via pipes"

More information

CPSC 457 OPERATING SYSTEMS MIDTERM EXAM

CPSC 457 OPERATING SYSTEMS MIDTERM EXAM CPSC 457 OPERATING SYSTEMS MIDTERM EXAM Department of Computer Science University of Calgary Professor: Carey Williamson March 9, 2010 This is a CLOSED BOOK exam. Textbooks, notes, laptops, calculators,

More information

Unix Processes. What is a Process?

Unix Processes. What is a Process? Unix Processes Process -- program in execution shell spawns a process for each command and terminates it when the command completes Many processes all multiplexed to a single processor (or a small number

More information

Process Management 1

Process Management 1 Process Management 1 Goals of this Lecture Help you learn about: Creating new processes Programmatically redirecting stdin, stdout, and stderr (Appendix) communication between processes via pipes Why?

More information

Boot Process in details for (X86) Computers

Boot Process in details for (X86) Computers Boot Process in details for (X86) Computers Hello,,, Let's discuss what happens between the time that you power up your PC and when the desktop appears. In fact we should know that the boot process differs

More information

W4118 Operating Systems. Junfeng Yang

W4118 Operating Systems. Junfeng Yang W4118 Operating Systems Junfeng Yang What is a process? Outline Process dispatching Common process operations Inter-process Communication What is a process Program in execution virtual CPU Process: an

More information

CS 326: Operating Systems. CPU Scheduling. Lecture 6

CS 326: Operating Systems. CPU Scheduling. Lecture 6 CS 326: Operating Systems CPU Scheduling Lecture 6 Today s Schedule Agenda? Context Switches and Interrupts Basic Scheduling Algorithms Scheduling with I/O Symmetric multiprocessing 2/7/18 CS 326: Operating

More information

Problem Set: Processes

Problem Set: Processes Lecture Notes on Operating Systems Problem Set: Processes 1. Answer yes/no, and provide a brief explanation. (a) Can two processes be concurrently executing the same program executable? (b) Can two running

More information

Inter-Process Communication

Inter-Process Communication CS 326: Operating Systems Inter-Process Communication Lecture 10 Today s Schedule Shared Memory Pipes 2/28/18 CS 326: Operating Systems 2 Today s Schedule Shared Memory Pipes 2/28/18 CS 326: Operating

More information

High Performance Computing Lecture 11. Matthew Jacob Indian Institute of Science

High Performance Computing Lecture 11. Matthew Jacob Indian Institute of Science High Performance Computing Lecture 11 Matthew Jacob Indian Institute of Science Agenda 1. Program execution: Compilation, Object files, Function call and return, Address space, Data & its representation

More information

What is a Process? Processes and Process Management Details for running a program

What is a Process? Processes and Process Management Details for running a program 1 What is a Process? Program to Process OS Structure, Processes & Process Management Don Porter Portions courtesy Emmett Witchel! A process is a program during execution. Ø Program = static file (image)

More information

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

Operating Systems. Computer Science & Information Technology (CS) Rank under AIR 100 GATE- 2016-17 Postal Correspondence 1 Operating Systems Computer Science & Information Technology (CS) 20 Rank under AIR 100 Postal Correspondence Examination Oriented Theory, Practice Set Key concepts,

More information

Mon Sep 17, 2007 Lecture 3: Process Management

Mon Sep 17, 2007 Lecture 3: Process Management Mon Sep 17, 2007 Lecture 3: Process Management September 19, 2007 1 Review OS mediates between hardware and user software QUIZ: Q: Name three layers of a computer system where the OS is one of these layers.

More information

Computer Systems II. First Two Major Computer System Evolution Steps

Computer Systems II. First Two Major Computer System Evolution Steps Computer Systems II Introduction to Processes 1 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent processes) 2 1 At First (1945 1955) In the beginning,

More information

OS Structure, Processes & Process Management. Don Porter Portions courtesy Emmett Witchel

OS Structure, Processes & Process Management. Don Porter Portions courtesy Emmett Witchel OS Structure, Processes & Process Management Don Porter Portions courtesy Emmett Witchel 1 What is a Process?! A process is a program during execution. Ø Program = static file (image) Ø Process = executing

More information

Processes. CS3026 Operating Systems Lecture 05

Processes. CS3026 Operating Systems Lecture 05 Processes CS3026 Operating Systems Lecture 05 Dispatcher Admit Ready Queue Dispatch Processor Release Timeout or Yield Event Occurs Blocked Queue Event Wait Implementation: Using one Ready and one Blocked

More information

Process Time. Steven M. Bellovin January 25,

Process Time. Steven M. Bellovin January 25, Multiprogramming Computers don t really run multiple programs simultaneously; it just appears that way Each process runs to completion, but intermixed with other processes Process 1 6 ticks Process 2 Process

More information

3. Process Management in xv6

3. Process Management in xv6 Lecture Notes for CS347: Operating Systems Mythili Vutukuru, Department of Computer Science and Engineering, IIT Bombay 3. Process Management in xv6 We begin understanding xv6 process management by looking

More information

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

CPSC 341 OS & Networks. Processes. Dr. Yingwu Zhu CPSC 341 OS & Networks Processes Dr. Yingwu Zhu Process Concept Process a program in execution What is not a process? -- program on a disk A process is an active object, but a program is just a file It

More information

Process Management 1

Process Management 1 Process Management 1 Goals of this Lecture Help you learn about: Creating new processes Waiting for processes to terminate Executing new programs Shell structure Why? Creating new processes and executing

More information

Problem Set: Processes

Problem Set: Processes Lecture Notes on Operating Systems Problem Set: Processes 1. Answer yes/no, and provide a brief explanation. (a) Can two processes be concurrently executing the same program executable? (b) Can two running

More information

Princeton University Computer Science 217: Introduction to Programming Systems. Process Management

Princeton University Computer Science 217: Introduction to Programming Systems. Process Management Princeton University Computer Science 217: Introduction to Programming Systems Process Management 1 Goals of this Lecture Help you learn about: Creating new processes Waiting for processes to terminate

More information

518 Lecture Notes Week 3

518 Lecture Notes Week 3 518 Lecture Notes Week 3 (Sept. 15, 2014) 1/8 518 Lecture Notes Week 3 1 Topics Process management Process creation with fork() Overlaying an existing process with exec Notes on Lab 3 2 Process management

More information

PROCESSES. Jo, Heeseung

PROCESSES. Jo, Heeseung PROCESSES Jo, Heeseung TODAY'S TOPICS What is the process? How to implement processes? Inter-Process Communication (IPC) 2 WHAT IS THE PROCESS? Program? vs. Process? vs. Processor? 3 PROCESS CONCEPT (1)

More information

Processes. Jo, Heeseung

Processes. Jo, Heeseung Processes Jo, Heeseung Today's Topics What is the process? How to implement processes? Inter-Process Communication (IPC) 2 What Is The Process? Program? vs. Process? vs. Processor? 3 Process Concept (1)

More information

Fork() System Call and Processes. CS449 Fall 2017

Fork() System Call and Processes. CS449 Fall 2017 Fork() System Call and Processes CS449 Fall 2017 Programs and Processes Program: Executable binary (code and stabc data) Process: A program loaded into memory Program (executable binary with data and text

More information

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 20

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 20 CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 2018 Lecture 20 LAST TIME: UNIX PROCESS MODEL Began covering the UNIX process model and API Information associated with each process: A PID (process ID) to

More information

Princeton University Computer Science 217: Introduction to Programming Systems. Process Management

Princeton University Computer Science 217: Introduction to Programming Systems. Process Management Princeton University Computer Science 217: Introduction to Programming Systems Process Management 1 Goals of this Lecture Help you learn about: Creating new processes Waiting for processes to terminate

More information

Princeton University. Computer Science 217: Introduction to Programming Systems. Process Management

Princeton University. Computer Science 217: Introduction to Programming Systems. Process Management Princeton University Computer Science 217: Introduction to Programming Systems Process Management 1 Goals of this Lecture Help you learn about: Creating new processes Waiting for processes to terminate

More information

Processes COMPSCI 386

Processes COMPSCI 386 Processes COMPSCI 386 Elements of a Process A process is a program in execution. Distinct processes may be created from the same program, but they are separate execution sequences. call stack heap STACK

More information

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Processes and Non-Preemptive Scheduling. Otto J. Anshus Processes and Non-Preemptive Scheduling Otto J. Anshus Threads Processes Processes Kernel An aside on concurrency Timing and sequence of events are key concurrency issues We will study classical OS concurrency

More information

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems Processes CS 475, Spring 2018 Concurrent & Distributed Systems Review: Abstractions 2 Review: Concurrency & Parallelism 4 different things: T1 T2 T3 T4 Concurrency: (1 processor) Time T1 T2 T3 T4 T1 T1

More information

Chap 4, 5: Process. Dongkun Shin, SKKU

Chap 4, 5: Process. Dongkun Shin, SKKU Chap 4, 5: Process 1 Process Concept Job A bundle of program and data to be executed An entity before submission for execution Process (= running program) An entity that is registered to kernel for execution

More information

The Early System Start-Up Process. Group Presentation by: Tianyuan Liu, Caiwei He, Krishna Parasuram Srinivasan, Wenbin Xu

The Early System Start-Up Process. Group Presentation by: Tianyuan Liu, Caiwei He, Krishna Parasuram Srinivasan, Wenbin Xu The Early System Start-Up Process Group Presentation by: Tianyuan Liu, Caiwei He, Krishna Parasuram Srinivasan, Wenbin Xu 1 Boot Process Booting is the initialization of a computerized system In Linux,

More information

* What are the different states for a task in an OS?

* What are the different states for a task in an OS? * Kernel, Services, Libraries, Application: define the 4 terms, and their roles. The kernel is a computer program that manages input/output requests from software, and translates them into data processing

More information

CPSC 457 OPERATING SYSTEMS MIDTERM EXAM SOLUTION

CPSC 457 OPERATING SYSTEMS MIDTERM EXAM SOLUTION CPSC 457 OPERATING SYSTEMS MIDTERM EXAM SOLUTION Department of Computer Science University of Calgary Professor: Carey Williamson October 29, 2008 This is a CLOSED BOOK exam. Textbooks, notes, laptops,

More information

by Marina Cholakyan, Hyduke Noshadi, Sepehr Sahba and Young Cha

by Marina Cholakyan, Hyduke Noshadi, Sepehr Sahba and Young Cha CS 111 Scribe Notes for 4/11/05 by Marina Cholakyan, Hyduke Noshadi, Sepehr Sahba and Young Cha Processes What is a process? A process is a running instance of a program. The Web browser you're using to

More information

2/14/2012. Using a layered approach, the operating system is divided into N levels or layers. Also view as a stack of services

2/14/2012. Using a layered approach, the operating system is divided into N levels or layers. Also view as a stack of services Rensselaer Polytechnic Institute CSC 432 Operating Systems David Goldschmidt, Ph.D. Using a layered approach, the operating system is divided into N levels or layers Layer 0 is the hardware Layer 1 is

More information

Operating System Design

Operating System Design Operating System Design Processes Operations Inter Process Communication (IPC) Neda Nasiriani Fall 2018 1 Process 2 Process Lifecycle 3 What information is needed? If you want to design a scheduler to

More information

IA32 OS START-UP UEFI FIRMWARE. CS124 Operating Systems Fall , Lecture 6

IA32 OS START-UP UEFI FIRMWARE. CS124 Operating Systems Fall , Lecture 6 IA32 OS START-UP UEFI FIRMWARE CS124 Operating Systems Fall 2017-2018, Lecture 6 2 Last Time: IA32 Bootstrap Computers and operating systems employ a bootstrap process to load and start the operating system

More information

Scheduling. CS 161: Lecture 4 2/9/17

Scheduling. CS 161: Lecture 4 2/9/17 Scheduling CS 161: Lecture 4 2/9/17 Where does the first process come from? The Linux Boot Process Machine turned on; BIOS runs BIOS: Basic Input/Output System Stored in flash memory on motherboard Determines

More information

Operating Systems Design Fall 2010 Exam 1 Review. Paul Krzyzanowski

Operating Systems Design Fall 2010 Exam 1 Review. Paul Krzyzanowski Operating Systems Design Fall 2010 Exam 1 Review Paul Krzyzanowski pxk@cs.rutgers.edu 1 Question 1 To a programmer, a system call looks just like a function call. Explain the difference in the underlying

More information

Chapter 3: Process Concept

Chapter 3: Process Concept Chapter 3: Process Concept Chapter 3: Process Concept Process Concept Process Scheduling Operations on Processes Inter-Process Communication (IPC) Communication in Client-Server Systems Objectives 3.2

More information

Chapter 3: Process Concept

Chapter 3: Process Concept Chapter 3: Process Concept Chapter 3: Process Concept Process Concept Process Scheduling Operations on Processes Inter-Process Communication (IPC) Communication in Client-Server Systems Objectives 3.2

More information

Boot. How OS boots

Boot. How OS boots Boot How OS boots 67 1 Booting sequence 1. Turn on 2. CPU jump to address of BIOS (0xFFFF0) 3. BIOS runs POST (Power-On Self Test) 4. Find bootable devices 5. Loads and execute boot sector from MBR 6.

More information

CSE 451: Operating Systems Winter Module 4 Processes. Mark Zbikowski Allen Center 476

CSE 451: Operating Systems Winter Module 4 Processes. Mark Zbikowski Allen Center 476 CSE 451: Operating Systems Winter 2015 Module 4 Processes Mark Zbikowski mzbik@cs.washington.edu Allen Center 476 2013 Gribble, Lazowska, Levy, Zahorjan Process management This module begins a series of

More information

Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2

Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2 Lecture 3: Processes Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2 Process in General 3.3 Process Concept Process is an active program in execution; process

More information

Systems Programming/ C and UNIX

Systems Programming/ C and UNIX Systems Programming/ C and UNIX Alice E. Fischer Lecture 6: Processes October 9, 2017 Alice E. FischerLecture 6: Processes Lecture 5: Processes... 1/26 October 9, 2017 1 / 26 Outline 1 Processes 2 Process

More information

Introduction. CS3026 Operating Systems Lecture 01

Introduction. CS3026 Operating Systems Lecture 01 Introduction CS3026 Operating Systems Lecture 01 One or more CPUs Device controllers (I/O modules) Memory Bus Operating system? Computer System What is an Operating System An Operating System is a program

More information

Chapter 3: Process Concept

Chapter 3: Process Concept Chapter 3: Process Concept Silberschatz, Galvin and Gagne 2013! Chapter 3: Process Concept Process Concept" Process Scheduling" Operations on Processes" Inter-Process Communication (IPC)" Communication

More information

CSE 410: Systems Programming

CSE 410: Systems Programming CSE 410: Systems Programming Concurrency Ethan Blanton Department of Computer Science and Engineering University at Buffalo Logical Control Flows The text defines a logical control flow as: [A] series

More information

ENGR 3950U / CSCI 3020U Midterm Exam SOLUTIONS, Fall 2012 SOLUTIONS

ENGR 3950U / CSCI 3020U Midterm Exam SOLUTIONS, Fall 2012 SOLUTIONS SOLUTIONS ENGR 3950U / CSCI 3020U (Operating Systems) Midterm Exam October 23, 2012, Duration: 80 Minutes (10 pages, 12 questions, 100 Marks) Instructor: Dr. Kamran Sartipi Question 1 (Computer Systgem)

More information

Class average is Undergraduates are performing better. Working with low-level microcontroller timers

Class average is Undergraduates are performing better. Working with low-level microcontroller timers Student feedback Low grades of the midterm exam Class average is 86.16 Undergraduates are performing better Cheat sheet on the final exam? You will be allowed to bring one page of cheat sheet to the final

More information

Processes in linux. What s s a process? process? A dynamically executing instance of a program. David Morgan. David Morgan

Processes in linux. What s s a process? process? A dynamically executing instance of a program. David Morgan. David Morgan Processes in linux David Morgan What s s a process? process? A dynamically executing instance of a program 1 Constituents of a process its code data various attributes OS needs to manage it OS keeps track

More information

Processes, Context Switching, and Scheduling. Kevin Webb Swarthmore College January 30, 2018

Processes, Context Switching, and Scheduling. Kevin Webb Swarthmore College January 30, 2018 Processes, Context Switching, and Scheduling Kevin Webb Swarthmore College January 30, 2018 Today s Goals What is a process to the OS? What are a process s resources and how does it get them? In particular:

More information

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

Processes. CS439: Principles of Computer Systems January 24, 2018 Processes CS439: Principles of Computer Systems January 24, 2018 Last Time History Lesson Hardware expensive, humans cheap Hardware cheap, humans expensive Hardware very cheap, humans very expensive Dual-mode

More information

fork System-Level Function

fork System-Level Function Princeton University Computer Science 217: Introduction to Programming Systems Process Management Goals of this Lecture Help you learn about: Creating new processes Waiting for processes to terminate Executing

More information

Process. Heechul Yun. Disclaimer: some slides are adopted from the book authors slides with permission 1

Process. Heechul Yun. Disclaimer: some slides are adopted from the book authors slides with permission 1 Process Heechul Yun Disclaimer: some slides are adopted from the book authors slides with permission 1 Recap OS services Resource (CPU, memory) allocation, filesystem, communication, protection, security,

More information

Process Description and Control

Process Description and Control Process Description and Control B.Ramamurthy 1/28/02 B.Ramamurthy 1 Introduction The fundamental task of any operating system is process management. OS must allocate resources to processes, enable sharing

More information

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

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto Ricardo Rocha Department of Computer Science Faculty of Sciences University of Porto Slides based on the book Operating System Concepts, 9th Edition, Abraham Silberschatz, Peter B. Galvin and Greg Gagne,

More information

Process management. What s in a process? What is a process? The OS s process namespace. A process s address space (idealized)

Process management. What s in a process? What is a process? The OS s process namespace. A process s address space (idealized) Process management CSE 451: Operating Systems Spring 2012 Module 4 Processes Ed Lazowska lazowska@cs.washington.edu Allen Center 570 This module begins a series of topics on processes, threads, and synchronization

More information

CSC 1600 Unix Processes. Goals of This Lecture

CSC 1600 Unix Processes. Goals of This Lecture CSC 1600 Unix Processes q Processes Goals of This Lecture q Process vs. program q Context switching q Creating a new process q fork: process creates a new child process q wait: parent waits for child process

More information

Lecture 4: Memory Management & The Programming Interface

Lecture 4: Memory Management & The Programming Interface CS 422/522 Design & Implementation of Operating Systems Lecture 4: Memory Management & The Programming Interface Zhong Shao Dept. of Computer Science Yale University Acknowledgement: some slides are taken

More information

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

Operating System. Chapter 3. Process. Lynn Choi School of Electrical Engineering Operating System Chapter 3. Process Lynn Choi School of Electrical Engineering Process Def: A process is an instance of a program in execution. One of the most profound ideas in computer science. Not the

More information

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

Roadmap. Tevfik Ko!ar. CSC Operating Systems Fall Lecture - III Processes. Louisiana State University. Processes. September 1 st, 2009 CSC 4103 - Operating Systems Fall 2009 Lecture - III Processes Tevfik Ko!ar Louisiana State University September 1 st, 2009 1 Roadmap Processes Basic Concepts Process Creation Process Termination Context

More information

CSE506: Operating Systems CSE 506: Operating Systems

CSE506: Operating Systems CSE 506: Operating Systems CSE 506: Operating Systems What Software Expects of the OS What Software Expects of the OS Shell Memory Address Space for Process System Calls System Services Launching Program Executables Shell Gives

More information

Process! Process Creation / Termination! Process Transitions in" the Two-State Process Model! A Two-State Process Model!

Process! Process Creation / Termination! Process Transitions in the Two-State Process Model! A Two-State Process Model! Process! Process Creation / Termination!!! A process (sometimes called a task, or a job) is a program in execution"!! Process is not the same as program "!! We distinguish between a passive program stored

More information

CSE 410: Computer Systems Spring Processes. John Zahorjan Allen Center 534

CSE 410: Computer Systems Spring Processes. John Zahorjan Allen Center 534 CSE 410: Computer Systems Spring 2018 Processes John Zahorjan zahorjan@cs.washington.edu Allen Center 534 1. What is a process? Processes 2. What's the process namespace? 3. How are processes represented

More information

Lecture 4: Process Management

Lecture 4: Process Management Lecture 4: Process Management (Chapters 2-3) Process: execution context of running program. A process does not equal a program! Process is an instance of a program Many copies of same program can be running

More information

Linux System Administration

Linux System Administration System Processes Objective At the conclusion of this module, the student will be able to: Describe and define a process Identify a process ID, the parent process and the child process Learn the PID for

More information

ECE 471 Embedded Systems Lecture 12

ECE 471 Embedded Systems Lecture 12 ECE 471 Embedded Systems Lecture 12 Vince Weaver http://www.eece.maine.edu/~vweaver vincent.weaver@maine.edu 8 October 2015 Announcements Homework grades have been sent out, let me know if you did not

More information

Processes. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Processes. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University Processes Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu OS Internals User space shell ls trap shell ps Kernel space File System Management I/O

More information

Lecture 17: Threads and Scheduling. Thursday, 05 Nov 2009

Lecture 17: Threads and Scheduling. Thursday, 05 Nov 2009 CS211: Programming and Operating Systems Lecture 17: Threads and Scheduling Thursday, 05 Nov 2009 CS211 Lecture 17: Threads and Scheduling 1/22 Today 1 Introduction to threads Advantages of threads 2 User

More information

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo PROCESS MANAGEMENT Operating Systems 2015 Spring by Euiseong Seo Today s Topics Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication

More information

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

Process Concepts. CSC400 - Operating Systems. 3. Process Concepts. J. Sumey CSC400 - Operating Systems 3. Process Concepts J. Sumey Overview Concurrency Processes & Process States Process Accounting Interrupts & Interrupt Processing Interprocess Communication CSC400 - Process

More information

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

OS COMPONENTS OVERVIEW OF UNIX FILE I/O. CS124 Operating Systems Fall , Lecture 2 OS COMPONENTS OVERVIEW OF UNIX FILE I/O CS124 Operating Systems Fall 2017-2018, Lecture 2 2 Operating System Components (1) Common components of operating systems: Users: Want to solve problems by using

More information

CS 201. Processes. Gerson Robboy Portland State University

CS 201. Processes. Gerson Robboy Portland State University CS 201 Processes Gerson Robboy Portland State University Review Definition: A process is an instance of a running program. One of the most fundamental concepts in computer science. Not the same as program

More information

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

Getting to know you. Anatomy of a Process. Processes. Of Programs and Processes Getting to know you Processes A process is an abstraction that supports running programs A sequential stream of execution in its own address space A process is NOT the same as a program! So, two parts

More information

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

Processes. Process Management Chapter 3. When does a process gets created? When does a process gets terminated? Processes Process Management Chapter 3 1 A process is a program in a state of execution (created but not terminated) Program is a passive entity one on your disk (survivor.class, kelly.out, ) Process is

More information

Operating Systems. Lecture 05

Operating Systems. Lecture 05 Operating Systems Lecture 05 http://web.uettaxila.edu.pk/cms/sp2013/seosbs/ February 25, 2013 Process Scheduling, System Calls Execution (Fork,Wait,Exit,Exec), Inter- Process Communication Schedulers Long

More information

MARUTHI SCHOOL OF BANKING (MSB)

MARUTHI SCHOOL OF BANKING (MSB) MARUTHI SCHOOL OF BANKING (MSB) SO IT - OPERATING SYSTEM(2017) 1. is mainly responsible for allocating the resources as per process requirement? 1.RAM 2.Compiler 3.Operating Systems 4.Software 2.Which

More information

Operating Systems Process description and control

Operating Systems Process description and control Operating Systems Process description and control Mathieu Delalandre (PhD) François-Rabelais University, Tours city, France mathieu.delalandre@univ-tours.fr Process description and control (1) Main memory

More information

Advanced Operating Systems and Virtualization. Alessandro Pellegrini A.Y. 2017/2018

Advanced Operating Systems and Virtualization. Alessandro Pellegrini A.Y. 2017/2018 Advanced Operating Systems and Virtualization Alessandro Pellegrini A.Y. 2017/2018 Basic Information Lecture Schedule: Course begins today! Course ends on June 1 st Lecture slots: Tuesday, 08.00 am 10.00

More information

Process Management! Goals of this Lecture!

Process Management! Goals of this Lecture! Process Management! 1 Goals of this Lecture! Help you learn about:" Creating new processes" Programmatically redirecting stdin, stdout, and stderr" Unix system-level functions for I/O" The Unix stream

More information

Processes. What s s a process? process? A dynamically executing instance of a program. David Morgan

Processes. What s s a process? process? A dynamically executing instance of a program. David Morgan Processes David Morgan What s s a process? process? A dynamically executing instance of a program 1 Constituents of a process its code data various attributes OS needs to manage it OS keeps track of all

More information

CSE 153 Design of Operating Systems Fall 2018

CSE 153 Design of Operating Systems Fall 2018 CSE 153 Design of Operating Systems Fall 2018 Lecture 4: Processes (2) Threads Process Creation: Unix In Unix, processes are created using fork() int fork() fork() Creates and initializes a new PCB Creates

More information

Fall 2015 COMP Operating Systems. Lab #3

Fall 2015 COMP Operating Systems. Lab #3 Fall 2015 COMP 3511 Operating Systems Lab #3 Outline n Operating System Debugging, Generation and System Boot n Review Questions n Process Control n UNIX fork() and Examples on fork() n exec family: execute

More information

Sistemi in Tempo Reale

Sistemi in Tempo Reale Laurea Specialistica in Ingegneria dell'automazione Sistemi in Tempo Reale Giuseppe Lipari Introduzione alla concorrenza Fundamentals Algorithm: It is the logical procedure to solve a certain problem It

More information

Engineering Robust Server Software

Engineering Robust Server Software Engineering Robust Server Software Containers Isolation Isolation: keep different programs separate Good for security Might also consider performance isolation Also has security implications (side channel

More information

Processes. Process Concept

Processes. Process Concept Processes These slides are created by Dr. Huang of George Mason University. Students registered in Dr. Huang s courses at GMU can make a single machine readable copy and print a single copy of each slide

More information

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

CS 31: Intro to Systems Processes. Kevin Webb Swarthmore College March 31, 2016 CS 31: Intro to Systems Processes Kevin Webb Swarthmore College March 31, 2016 Reading Quiz Anatomy of a Process Abstraction of a running program a dynamic program in execution OS keeps track of process

More information

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1 Memory Management Disclaimer: some slides are adopted from book authors slides with permission 1 CPU management Roadmap Process, thread, synchronization, scheduling Memory management Virtual memory Disk

More information

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

Processes & Threads. Today. Next Time. ! Process concept! Process model! Implementing processes! Multiprocessing once again. ! More of the same J Processes & Threads Today! Process concept! Process model! Implementing processes! Multiprocessing once again Next Time! More of the same J The process model! Most computers can do more than one thing

More information

Chapter 3: Processes. Operating System Concepts 9 th Edit9on

Chapter 3: Processes. Operating System Concepts 9 th Edit9on Chapter 3: Processes Operating System Concepts 9 th Edit9on Silberschatz, Galvin and Gagne 2013 Chapter 3: Processes 1. Process Concept 2. Process Scheduling 3. Operations on Processes 4. Interprocess

More information

CSE 120 Principles of Operating Systems

CSE 120 Principles of Operating Systems CSE 120 Principles of Operating Systems Spring 2018 Lecture 10: Paging Geoffrey M. Voelker Lecture Overview Today we ll cover more paging mechanisms: Optimizations Managing page tables (space) Efficient

More information

Processes. Process Scheduling, Process Synchronization, and Deadlock will be discussed further in Chapters 5, 6, and 7, respectively.

Processes. Process Scheduling, Process Synchronization, and Deadlock will be discussed further in Chapters 5, 6, and 7, respectively. Processes Process Scheduling, Process Synchronization, and Deadlock will be discussed further in Chapters 5, 6, and 7, respectively. 1. Process Concept 1.1 What is a Process? A process is a program in

More information

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

Processes. OS Structure. OS Structure. Modes of Execution. Typical Functions of an OS Kernel. Non-Kernel OS. COMP755 Advanced Operating Systems OS Structure Processes COMP755 Advanced Operating Systems An OS has many parts. The Kernel is the core of the OS. It controls the execution of the system. Many OS features run outside of the kernel, such

More information