Overview: Concurrent Architectures - Unix: Forks and Pipes

Size: px
Start display at page:

Download "Overview: Concurrent Architectures - Unix: Forks and Pipes"

Transcription

1 Overview: Concurrent Architectures - Unix: Forks and Pipes Other Matters: TuteLab-5 solutions and the proof of Peterson s Algorithm Ref: [Coulouris&al Ch 4] history architecture: monolithic vs microkernels, hypervisors processes: creation, synchronization, sleeping shells and command line interpretation file descriptors and I/O redirection pipes (based on lecture by Alistair Rendell, CDS 2009; architecture diagrams from Coulouris et al, Distributed Systems) COMP310 Lecture 20: Operating Systems: Unix Forks and Pipes2014 1

2 Unix - History origins - the Multics Project Bell AT&T, MIT and GE Ken Thomson and Dennis Ritchie the C language PDP 11 features hierarchical file system compatible I/O (file, device & inter-process) command language choice portability standards - POSIX descendants Version 7, BSD 4.2, SystemV, Solaris, XINU, Minix, Linux, MacOSX specification history and timeline the first Unix Port (1977) COMP310 Lecture 20: Operating Systems: Unix Forks and Pipes2014 2

3 Operating System Architecture (a) system layers ([Coulouris&al Fig 7.1]) (b) core OS functionality ([Coulouris&al Fig 7.2]) COMP310 Lecture 20: Operating Systems: Unix Forks and Pipes2014 3

4 Monolithic vs Micro- Kernels monolithic: all OS services within the kernel hard to maintain, port, ensure reliability; may be efficient e.g. most old OS: Windows (pre NT), MacOS (pre 9) monolithic and modular: high-level services as platform-independent modules better! e.g. most modern Unix implementations monolithic and layered: services are layered from high to- low level better except possibly reduced efficiency (e.g. Solaris) microkernel: only implements low-level process, memory, interrupt and message handling easiest to port, maintain, make reliable may be inefficient due to increased messaging e.g. MacOSX: Mach µkernel + BSD Unix, L4 can support multiple OS on 1 host (usually on a lower privilege level) COMP310 Lecture 20: Operating Systems: Unix Forks and Pipes2014 4

5 Monolithic vs Microkernels: Operation (a) process memory image ([Coulouris&al Fig 7.15])... Microkernel Hardware (b) µkernel supports middleware via subsystems ([Coulouris&al Fig 7.16]) COMP310 Lecture 20: Operating Systems: Unix Forks and Pipes2014 5

6 Hypervisors: Microkernels at a Higher Privilege Level virtualization provides the facility to abstract an OS from its physical resources guest OS obtains microkernel services from a hypervisor. e.g. VMWare, Xen this forms an essential technology for cloud computing Xen Architecture: ([Coulouris&al Fig 7.16]) communication goes through domain0 issue: mitigating the overheads of this opportunity: take advantage of guest OS migration save energy, better match of guest to H/W COMP310 Lecture 20: Operating Systems: Unix Forks and Pipes2014 6

7 Unix process creation is by cloning Unix Process Reproduction the standard Unix C library contains the function ÓÖ µ typical usage: Ô ÓÖ µ ÓÖ µ spawns a duplicate process (same memory, registers) except the return value is different 0 to the child; pid of child to the parent (never 0!) -1 if it fails example: forkexec.c ÓÖ µ ¼µ {»» Á Ñ Ø Ð " / b i n / g r e p " " g r e p " ÝÛÓÖ ÆÍÄÄ µ Ü ÐÔ µ ÓÖØ Ð } { }»» Ö Ø Ó Ô Ö ÒØ ÔÖÓ Ö Ñ what is the child? what is concurrent? why does grep appear twice? why might it abort? COMP310 Lecture 20: Operating Systems: Unix Forks and Pipes2014 7

8 ([Coulouris&al Fig 7.4]) Process Creation and Copy-on-write Semantics COMP310 Lecture 20: Operating Systems: Unix Forks and Pipes2014 8

9 Ô Ö ÓÖÑ Ð ³ Ø»» ¼µ Ü Ø Ô Ö ÒØ ³ Ø»» ² Ð ËØ ØÙ µ Û Ø co-ordination can be a problem: Process Requiem! a child was spawned to do something in parallel (concurrently) at some point the parent might need to be sure it is complete the ÒØ Û Ø ÒØ Ø ØÙ µ system call solves this waits for termination of a (any) child returns the pid of the child that has died argument gives status information (including exit code) for the child example ÓÖ µ ¼µ{ } Ð { ÒØ Ð ËØ ØÙ } concurrency? COMP310 Lecture 20: Operating Systems: Unix Forks and Pipes2014 9

10 Unix Processes Dozing why wait for time to pass? it may want to do something periodically it can make sure other processes get a chance other reasons? the ÒØ Ð Ô ÒØ µ system call enables this the supplied argument is the duration (in seconds) may return early if woken up (by a signal) return value indicates the sleep-time remaining use of Ð Ô ¼µ COMP310 Lecture 20: Operating Systems: Unix Forks and Pipes

11 Unix Shells a job control language pre-unix JCLs were proprietary and idiosyncratic not part of the Operating System (but must reflect its facilities) can have one (or more) shells per user e.g. sh - Bourne shell,csh - C Shell, tcsh - extended C-shell, bash - Bourne-again shell processes and process combinations are supported by shells ps emacs Bakery.java & ps -aux grep $USER java -ea Bakery 4 2 bakeryanalyzer can write executable programs in shell code (a script) (e.g. BakeryTraceViews) interpreted, not compiled first line of file indicates the appropriate interpreter COMP310 Lecture 20: Operating Systems: Unix Forks and Pipes

12 Command-Line Interpretation Fork() Fork() wait(&status) exec(cmd arglist) Fork() exec(cmd2 args2) exec(cmd1 args1) exit(status) exit(status) wait(&status) exit(status)?wait(&status)? (See Zombies in Lab7) cmd arglist cmd1 args1 & cmd2 args2 COMP310 Lecture 20: Operating Systems: Unix Forks and Pipes

13 UNIX File Descriptors non-negative integers denoting an open I/O channel they are indices (0, 1, 2,... ) the File Descriptor Table (FDT) associated with the current process the corresponding table entries only mean something to the operating system! three descriptors are standard: Ø Ò: 0, Ø ÓÙØ: 1, Ø ÖÖ: 2 (by default, associated with keyboard & current command window) the FDT is preserved across Ü µ and copied during ÓÖ µ COMP310 Lecture 20: Operating Systems: Unix Forks and Pipes

14 File Descriptor Table Operation opening a file first free entry in the FDT is chosen closing a file entry in FDT is marked free opposite to open! 0 1 Open Close Redirecting I/O, for example Ø ÓÙØ: user cannot change the FDT directly the ÒØ ÙÔ¾ ÒØ ÓÐ ÒØ Ò Û µ system call can do this: ÙÔ¾ ½µ Xterm outfile outfile outfile outfile outfile Close dup (copy fd 5 to fd 1) Close COMP310 Lecture 20: Operating Systems: Unix Forks and Pipes

15 UNIX Pipes consider ps -aux grep 666 ps writes to Ø ÓÙØ grep reads from Ø Ò I/O has been re-directed by the shell mental model of a pipe: it s a buffer for characters handled by I/O sub-system of Unix may only be one-way (Solaris has two-way) pipe dependencies: P2 will wait for production P1 will not wait for consumption there may also be buffering in P1 the importance of timely flushing! what does this mean? (COMP230 Lab9 2010) P 1 P P 2 COMP310 Lecture 20: Operating Systems: Unix Forks and Pipes

16 Creating UNIX Pipes opening a pipe: ÚÓ Ô Ô ÒØ Ô Ô ¾ µ P 1 Ô Ô ¼ is set to file descriptor of the input end of the pipe P 2 Ô Ô ½ is set to file descriptor of the output end of the pipe the result does not connect two processes! connecting two processes by a pipe fork the process, but do it after opening a pipe close unwanted descriptors P 1 P 2 COMP310 Lecture 20: Operating Systems: Unix Forks and Pipes

17 Command Line I/O Redirection cmd1 args1 > file Fork() cmd1 cmd2 create pipe open(file); make it stdout Fork() Fork() There is a mistake what is it? wait(&status) exec(cmd1 args1) wait(&status) redirect o/p exec(cmd2 ) redirect i/p exec(cmd1 ) exit(status) exit(status) exit(status) wait(&status) close pipe Q1: what is the mistake? (1) redirects need to be swapped (2) commands need to be swapped (3) either of the above (4) both of (1) and (2) (5) none of the above COMP310 Lecture 20: Operating Systems: Unix Forks and Pipes

18 Pipelines for Sub-processes and Shared Processes sub-process pipeline: desired state make pipes (before forking) fork two times close pipes in parent each child closes the descriptors that it won t use each child does an Ü µ if appropriate red state parent pipes can be shared integrity of messages a pipe is just a stream of chars no interleaving BUT care required with buffering messages must be less than 2KB Producer 1 child Consumer Producer Filter Consumer child child child Producer 2 child child COMP310 Lecture 20: Operating Systems: Unix Forks and Pipes

19 Putting it all Together: Parent Pipes its Input to its Child Q2: on which side is the code for the child process? piperpwc.c Ô ¾ Ö ÒØ Ô Ô Ôµ ½µ { Ð { } Ô ÖÖÓÖ " n o p i p e " µ Ü Ø ½µ ÓÖ µ ¼µ { ÒØ Ð ËØ ØÙ Ô ¼ µ ÐÓ Ø Ö µµ Ç µ Û Ð Ô ½ µ ÐÓ Ö Ö Ô ¼ ² ½µµ Û Ð ¼µ > ÛÖ Ø Ô ½ ² ½µ ½µ " p i p e b r o k e n " µ Ô ÖÖÓÖ µ ÔÙØ Ö Ö ½µ { " p i p e b r o k e n " µ Ô ÖÖÓÖ Ô ¼ µ ÐÓ } } Ô ½ µ ÐÓ ½µ Ü Ø } Ü Ø ½µ } Ô ½ µ ÐÓ ² Ð ËØ ØÙ µ Û Ø Ö ØÙÖÒ ¼µ Ô ¼ µ ÐÓ ¼µ Ü Ø Q3: is the 2nd ÐÓ Ô ¼ µ on the left good style? needed? Q4: and the 2nd ÐÓ Ô ½ µ on the right? COMP310 Lecture 20: Operating Systems: Unix Forks and Pipes

20 Ô ½ µ ÐÓ»» ½ µ ººº Ô ¼ µ ÐÓ»» ¾ µ ººº Ø Ö µµ Ç µ Û Ð µ ÔÙØ Ö ËÌ ÇÍÌ ÁÄ ÆÇ µ ÐÓ ² Ð ËØ ØÙ µ Û Ø Parent Pipes its Input to its Child by I/O Redirection Use the ÙÔ¾ ÒØ ÓÐ ÒØ Ò Û µ call to redirect the pipe to Ø ÓÙØ (1) of parent and Ø Ò (0) of child: Ô ¾ Ö ÒØ Ô Ô Ôµ ½µ { Ð { } Ð ËØ ØÙ ÒØ Ô ÖÖÓÖ " n o p i p e " µ Ü Ø ½µ»» µ ººº ÓÖ µ ¼µ { Ø Ö µµ Ç µ Û Ð µ ÔÙØ Ö } Ö ØÙÖÒ ¼µ Q5: should the ÙÔ¾ µ calls be at (A), or (B1) and (B2)? Ü Ø ¼µ Q6:: the appropriate calls are: ÙÔ¾ Ô ¼ ½µ (1) for child, ÙÔ¾ Ô ½ ¼µ and for parent ÙÔ¾ Ô ¼ ¼µ (2) for child, ÙÔ¾ Ô ½ ½µ and for parent ÙÔ¾ Ô ½ ½µ (3) for child, ÙÔ¾ Ô ¼ ¼µ and for parent ÙÔ¾ Ô ½ ¼µ (4) for child, ÙÔ¾ Ô ¼ ½µ and for parent COMP310 Lecture 20: Operating Systems: Unix Forks and Pipes

Concurrent Architectures - Unix: Sockets, Select & Signals

Concurrent Architectures - Unix: Sockets, Select & Signals Concurrent Architectures - Unix: Sockets, Select & Signals Assignment 1: Drop In Labs reminder check compiles in CS labs & you have submitted all your files in StReAMS! formatting your work: why to 80

More information

UNIX Kernel. UNIX History

UNIX Kernel. UNIX History UNIX History UNIX Kernel 1965-1969 Bell Labs participates in the Multics project. 1969 Ken Thomson develops the first UNIX version in assembly for an DEC PDP-7 1973 Dennis Ritchie helps to rewrite UNIX

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

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

Lecture Topics. Announcements. Today: Operating System Overview (Stallings, chapter , ) Next: Processes (Stallings, chapter Lecture Topics Today: Operating System Overview (Stallings, chapter 2.1-2.4, 2.8-2.10) Next: Processes (Stallings, chapter 3.1-3.6) 1 Announcements Consulting hours posted Self-Study Exercise #3 posted

More information

The Classical OS Model in Unix

The Classical OS Model in Unix The Classical OS Model in Unix Nachos Exec/Exit/Join Example Exec parent Join Exec child Exit SpaceID pid = Exec( myprogram, 0); Create a new process running the program myprogram. int status = Join(pid);

More information

CSCI 2132 Software Development. Lecture 2: Introduction to UNIX and Unix-like Operating Systems

CSCI 2132 Software Development. Lecture 2: Introduction to UNIX and Unix-like Operating Systems CSCI 2132 Software Development Lecture 2: Introduction to UNIX and Unix-like Operating Systems Instructor: Vlado Keselj Faculty of Computer Science Dalhousie University 7-Sep-2018 (2) CSCI 2132 1 Previous

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

W4118: OS Overview. Junfeng Yang

W4118: OS Overview. Junfeng Yang W4118: OS Overview Junfeng Yang References: Modern Operating Systems (3 rd edition), Operating Systems Concepts (8 th edition), previous W4118, and OS at MIT, Stanford, and UWisc Outline OS definitions

More information

System Programming. Introduction to Unix

System Programming. Introduction to Unix Content : by Dr. B. Boufama School of Computer Science University of Windsor Instructor: Dr. A. Habed adlane@cs.uwindsor.ca http://cs.uwindsor.ca/ adlane/60-256 Content Content 1 Introduction 2 3 Introduction

More information

Linux for Beginners. Windows users should download putty or bitvise:

Linux for Beginners. Windows users should download putty or bitvise: Linux for Beginners Windows users should download putty or bitvise: https://putty.org/ Brief History UNIX (1969) written in PDP-7 assembly, not portable, and designed for programmers as a reaction by Bell

More information

(MCQZ-CS604 Operating Systems)

(MCQZ-CS604 Operating Systems) command to resume the execution of a suspended job in the foreground fg (Page 68) bg jobs kill commands in Linux is used to copy file is cp (Page 30) mv mkdir The process id returned to the child process

More information

Practical Computing-II. Programming in the Linux Environment. 0. An Introduction. B.W.Gore. March 20, 2015

Practical Computing-II. Programming in the Linux Environment. 0. An Introduction. B.W.Gore. March 20, 2015 Practical Computing-II March 20, 2015 0. An Introduction About The Course CMS M.2.2 Practical Computing-II About The Course CMS M.2.2 Practical Computing-II 25 credits (33.33% weighting) About The Course

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

UNIX. The Very 10 Short Howto for beginners. Soon-Hyung Yook. March 27, Soon-Hyung Yook UNIX March 27, / 29

UNIX. The Very 10 Short Howto for beginners. Soon-Hyung Yook. March 27, Soon-Hyung Yook UNIX March 27, / 29 UNIX The Very 10 Short Howto for beginners Soon-Hyung Yook March 27, 2015 Soon-Hyung Yook UNIX March 27, 2015 1 / 29 Table of Contents 1 History of Unix 2 What is UNIX? 3 What is Linux? 4 How does Unix

More information

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files CSC209 Review CSC209: Software tools Unix files and directories permissions utilities/commands Shell programming quoting wild cards files ... and systems programming C basic syntax functions arrays structs

More information

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files. Compiler vs.

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files. Compiler vs. CSC209 Review CSC209: Software tools Unix files and directories permissions utilities/commands Shell programming quoting wild cards files... and systems programming C basic syntax functions arrays structs

More information

Design Overview of the FreeBSD Kernel CIS 657

Design Overview of the FreeBSD Kernel CIS 657 Design Overview of the FreeBSD Kernel CIS 657 Organization of the Kernel Machine-independent 86% of the kernel (80% in 4.4BSD) C code Machine-dependent 14% of kernel Only 0.6% of kernel in assembler (2%

More information

Design Overview of the FreeBSD Kernel. Organization of the Kernel. What Code is Machine Independent?

Design Overview of the FreeBSD Kernel. Organization of the Kernel. What Code is Machine Independent? Design Overview of the FreeBSD Kernel CIS 657 Organization of the Kernel Machine-independent 86% of the kernel (80% in 4.4BSD) C C code Machine-dependent 14% of kernel Only 0.6% of kernel in assembler

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

Perl and R Scripting for Biologists

Perl and R Scripting for Biologists Perl and R Scripting for Biologists Lukas Mueller PLBR 4092 Course overview Linux basics (today) Linux advanced (Aure, next week) Why Linux? Free open source operating system based on UNIX specifications

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

Today. Operating System Evolution. CSCI 4061 Introduction to Operating Systems. Gen 1: Mono-programming ( ) OS Evolution Unix Overview

Today. Operating System Evolution. CSCI 4061 Introduction to Operating Systems. Gen 1: Mono-programming ( ) OS Evolution Unix Overview Today CSCI 4061 Introduction to s Instructor: Abhishek Chandra OS Evolution Unix Overview Unix Structure Shells and Utilities Calls and APIs 2 Evolution How did the OS evolve? Generation 1: Mono-programming

More information

CSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song

CSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song CSCE 313 Introduction to Computer Systems Instructor: Dezhen Song Programs, Processes, and Threads Programs and Processes Threads Programs, Processes, and Threads Programs and Processes Threads Processes

More information

CSCE 313: Intro to Computer Systems

CSCE 313: Intro to Computer Systems CSCE 313 Introduction to Computer Systems Instructor: Dr. Guofei Gu http://courses.cse.tamu.edu/guofei/csce313/ Programs, Processes, and Threads Programs and Processes Threads 1 Programs, Processes, and

More information

CS2028 -UNIX INTERNALS

CS2028 -UNIX INTERNALS DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY,SIRUVACHUR-621113. CS2028 -UNIX INTERNALS PART B UNIT 1 1. Explain briefly details about History of UNIX operating system? In 1965, Bell Telephone

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

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

OS lpr. www. nfsd gcc emacs ls 1/27/09. Process Management. CS 537 Lecture 3: Processes. Example OS in operation. Why Processes? Simplicity + Speed

OS lpr. www. nfsd gcc emacs ls 1/27/09. Process Management. CS 537 Lecture 3: Processes. Example OS in operation. Why Processes? Simplicity + Speed Process Management CS 537 Lecture 3: Processes Michael Swift This lecture begins a series of topics on processes, threads, and synchronization Today: processes and process management what are the OS units

More information

Reading Assignment 4. n Chapter 4 Threads, due 2/7. 1/31/13 CSE325 - Processes 1

Reading Assignment 4. n Chapter 4 Threads, due 2/7. 1/31/13 CSE325 - Processes 1 Reading Assignment 4 Chapter 4 Threads, due 2/7 1/31/13 CSE325 - Processes 1 What s Next? 1. Process Concept 2. Process Manager Responsibilities 3. Operations on Processes 4. Process Scheduling 5. Cooperating

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

CS 450 Operating System Week 4 Lecture Notes

CS 450 Operating System Week 4 Lecture Notes CS 450 Operating System Week 4 Lecture Notes Reading: Operating System Concepts (7 th Edition) - Silberschatz, Galvin, Gagne Chapter 5 - Pages 129 147 Objectives: 1. Explain the main Objective of Threads

More information

CSCI2467: Systems Programming Concepts

CSCI2467: Systems Programming Concepts CSCI2467: Systems Programming Concepts Class activity: bash shell literacy Instructor: Matthew Toups Fall 2017 Today 0 Shells History Usage Scripts vs. Programs 1 Bash shell: practical uses for your systems

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

THE AUSTRALIAN NATIONAL UNIVERSITY Practice Final Examination, October 2012

THE AUSTRALIAN NATIONAL UNIVERSITY Practice Final Examination, October 2012 THE AUSTRALIAN NATIONAL UNIVERSITY Practice Final Examination, October 2012 COMP2310 / COMP6310 (Concurrent and Distributed Systems ) Writing Period: 3 hours duration Study Period: 15 minutes duration

More information

ESE 333 Real-Time Operating Systems 2 What is an operating system? Two views: 1. Top-down view: Extended machine ffl Covers the details of the hardwar

ESE 333 Real-Time Operating Systems 2 What is an operating system? Two views: 1. Top-down view: Extended machine ffl Covers the details of the hardwar 1 A computer system consists of: ffl Hardware Physical devices Λ Processors Λ Memory Λ I/O devices Microprogramming Machine language (instruction set) ffl Software System programs Λ Operating system Λ

More information

Overview of Unix / Linux operating systems

Overview of Unix / Linux operating systems Overview of Unix / Linux operating systems Mohammad S. Hasan Staffordshire University, UK Overview of Unix / Linux operating systems Slide 1 Lecture Outline History and development of Unix / Linux Early

More information

SOFTWARE ARCHITECTURE 3. SHELL

SOFTWARE ARCHITECTURE 3. SHELL 1 SOFTWARE ARCHITECTURE 3. SHELL Tatsuya Hagino hagino@sfc.keio.ac.jp slides URL https://vu5.sfc.keio.ac.jp/sa/login.php 2 Software Layer Application Shell Library MIddleware Shell Operating System Hardware

More information

Operating System Structure

Operating System Structure CSE325 Principles of Operating Systems Operating System Structure David Duggan dduggan@sandia.gov January 24, 2013 A View of Operating System Services 1/24/13 CSE325 - OS Structure 2 Operating System Design

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

Today. Operating System Evolution. CSCI 4061 Introduction to Operating Systems. Gen 1: Mono-programming ( ) OS Evolution Unix Overview

Today. Operating System Evolution. CSCI 4061 Introduction to Operating Systems. Gen 1: Mono-programming ( ) OS Evolution Unix Overview Today CSCI 4061 Introduction to s Instructor: Abhishek Chandra OS Evolution Unix Overview Unix Structure Shells and Utilities Calls and APIs 2 Evolution How did the OS evolve? Dependent on hardware and

More information

UNIX. Session 2. UNIX processes and forking fork system call exec system call death of process kill fork and I/O using it UNIX.

UNIX. Session 2. UNIX processes and forking fork system call exec system call death of process kill fork and I/O using it UNIX. ProgrammingII Session 2 process handling processes and forking fork system call exec system call death of process kill fork and I/O using it ProgrammingII Short Course Notes Alan Dix 1996 II/20 process:

More information

CSC209 Review. Yeah! We made it!

CSC209 Review. Yeah! We made it! CSC209 Review Yeah! We made it! 1 CSC209: Software tools Unix files and directories permissions utilities/commands Shell programming quoting wild cards files 2 ... and C programming... C basic syntax functions

More information

Operating Systems. II. Processes

Operating Systems. II. Processes Operating Systems II. Processes Ludovic Apvrille ludovic.apvrille@telecom-paristech.fr Eurecom, office 470 http://soc.eurecom.fr/os/ @OS Eurecom Outline Concepts Definitions and basic concepts Process

More information

Classic Systems: Unix and THE. Presented by Hakim Weatherspoon

Classic Systems: Unix and THE. Presented by Hakim Weatherspoon Classic Systems: Unix and THE Presented by Hakim Weatherspoon The UNIX Time-Sharing System Dennis Ritchie and Ken Thompson Background of authors at Bell Labs Both won Turing Awards in 1983 Dennis Ritchie

More information

OS Structure. Kevin Webb Swarthmore College January 25, Relevant xkcd:

OS Structure. Kevin Webb Swarthmore College January 25, Relevant xkcd: OS Structure Kevin Webb Swarthmore College January 25, 2018 Relevant xkcd: One of the survivors, poking around in the ruins with the point of a spear, uncovers a singed photo of Richard Stallman. They

More information

CSCI 6730 / 4730 Operating Systems. Key Questions in System Design. Review: What is An Operating System? Key Points

CSCI 6730 / 4730 Operating Systems. Key Questions in System Design. Review: What is An Operating System? Key Points CSCI 6730 / 4730 Operating Systems Structures & System Design Review: What is An Operating System? Key Points Software ( ) that runs at all times Really, the part of the system that runs in mode (or need

More information

Shells. A shell is a command line interpreter that is the interface between the user and the OS. The shell:

Shells. A shell is a command line interpreter that is the interface between the user and the OS. The shell: Shells A shell is a command line interpreter that is the interface between the user and the OS. The shell: analyzes each command determines what actions are to be performed performs the actions Example:

More information

CISC2200 Threads Spring 2015

CISC2200 Threads Spring 2015 CISC2200 Threads Spring 2015 Process We learn the concept of process A program in execution A process owns some resources A process executes a program => execution state, PC, We learn that bash creates

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

Concurrent Execution

Concurrent Execution Concurrent Execution Overview: concepts and definitions modelling: parallel composition action interleaving algebraic laws shared actions composite processes process labelling, action relabeling and hiding

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

Exam Guide COMPSCI 386

Exam Guide COMPSCI 386 FOUNDATIONS We discussed in broad terms the three primary responsibilities of an operating system. Describe each. What is a process? What is a thread? What parts of a process are shared by threads? What

More information

Kernel Types Simple OS Examples System Calls. Operating Systems. Autumn CS4023

Kernel Types Simple OS Examples System Calls. Operating Systems. Autumn CS4023 Operating Systems Autumn 2017-2018 Outline 1 2 3 Types of 2.4, SGG The OS Kernel The kernel is the central component of an OS It has complete control over everything that occurs in the system Kernel overview

More information

Processes and Threads

Processes and Threads TDDI04 Concurrent Programming, Operating Systems, and Real-time Operating Systems Processes and Threads [SGG7] Chapters 3 and 4 Copyright Notice: The lecture notes are mainly based on Silberschatz s, Galvin

More information

Welcome to Linux. Lecture 1.1

Welcome to Linux. Lecture 1.1 Welcome to Linux Lecture 1.1 Some history 1969 - the Unix operating system by Ken Thompson and Dennis Ritchie Unix became widely adopted by academics and businesses 1977 - the Berkeley Software Distribution

More information

Operating System Kernels

Operating System Kernels Operating System Kernels Presenter: Saikat Guha Cornell University CS 614, Fall 2005 Operating Systems Initially, the OS was a run-time library Batch ( 55 65): Resident, spooled jobs Multiprogrammed (late

More information

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

Windows architecture. user. mode. Env. subsystems. Executive. Device drivers Kernel. kernel. mode HAL. Hardware. Process B. Process C. Structure Unix architecture users Functions of the System tools (shell, editors, compilers, ) standard library System call Standard library (printf, fork, ) OS kernel: processes, memory management, file

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

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

Operating Systems. Operating System Structure. Lecture 2 Michael O Boyle

Operating Systems. Operating System Structure. Lecture 2 Michael O Boyle Operating Systems Operating System Structure Lecture 2 Michael O Boyle 1 Overview Architecture impact User operating interaction User vs kernel Syscall Operating System structure Layers Examples 2 Lower-level

More information

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

Processes and Threads. Processes and Threads. Processes (2) Processes (1) Processes and Threads (Topic 2-1) 2 홍성수 Processes and Threads Question: What is a process and why is it useful? Why? With many things happening at once in a system, need some way of separating them all

More information

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

Mid Term from Feb-2005 to Nov 2012 CS604- Operating System Mid Term from Feb-2005 to Nov 2012 CS604- Operating System Latest Solved from Mid term Papers Resource Person Hina 1-The problem with priority scheduling algorithm is. Deadlock Starvation (Page# 84) Aging

More information

Operating System: Chap2 OS Structure. National Tsing-Hua University 2016, Fall Semester

Operating System: Chap2 OS Structure. National Tsing-Hua University 2016, Fall Semester Operating System: Chap2 OS Structure National Tsing-Hua University 2016, Fall Semester Outline OS Services OS-Application Interface OS Structure Chapter2 OS-Structure Operating System Concepts NTHU LSA

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

Creating a Shell or Command Interperter Program CSCI411 Lab

Creating a Shell or Command Interperter Program CSCI411 Lab Creating a Shell or Command Interperter Program CSCI411 Lab Adapted from Linux Kernel Projects by Gary Nutt and Operating Systems by Tannenbaum Exercise Goal: You will learn how to write a LINUX shell

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

Administrivia. Lab 1 will be up by tomorrow, Due Oct. 11

Administrivia. Lab 1 will be up by tomorrow, Due Oct. 11 p.1/45 Administrivia Lab 1 will be up by tomorrow, Due Oct. 11 - Due at start of lecture 4:15pm - Free extension to midnight if you come to lecture - Or for SCPD students only if you watch lecture live

More information

Operating System Structure

Operating System Structure Operating System Structure Heechul Yun Disclaimer: some slides are adopted from the book authors slides with permission Recap: Memory Hierarchy Fast, Expensive Slow, Inexpensive 2 Recap Architectural support

More information

CptS 360 (System Programming) Unit 2: Introduction to UNIX and Linux

CptS 360 (System Programming) Unit 2: Introduction to UNIX and Linux CptS 360 (System Programming) Unit 2: Introduction to UNIX and Linux Bob Lewis School of Engineering and Applied Sciences Washington State University Spring, 2018 Motivation APIs have a history: Learn

More information

www nfsd emacs lpr Process Management CS 537 Lecture 4: Processes Example OS in operation Why Processes? Simplicity + Speed

www nfsd emacs lpr Process Management CS 537 Lecture 4: Processes Example OS in operation Why Processes? Simplicity + Speed Process Management CS 537 Lecture 4: Processes Michael Swift This lecture begins a series of topics on processes, threads, and synchronization Today: processes and process management what are the OS units

More information

Implementation of a simple shell, xssh

Implementation of a simple shell, xssh Implementation of a simple shell, xssh What is a shell? A process that does command line interpretation Reads a command from standard input (stdin) Executes command corresponding to input line In simple

More information

Introduction to Cygwin Operating Environment

Introduction to Cygwin Operating Environment Introduction to Cygwin Operating Environment ICT 106 Fundamentals of Computer Systems Eric Li ICT106_Pract_week 1 1 What s Cygwin? Emulates Unix/Linux environment on a Windows Operating System; A collection

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

OS structure. Process management. Major OS components. CSE 451: Operating Systems Spring Module 3 Operating System Components and Structure

OS structure. Process management. Major OS components. CSE 451: Operating Systems Spring Module 3 Operating System Components and Structure CSE 451: Operating Systems Spring 2012 Module 3 Operating System Components and Structure Ed Lazowska lazowska@cs.washington.edu Allen Center 570 The OS sits between application programs and the it mediates

More information

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

CS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017 CS 471 Operating Systems Yue Cheng George Mason University Fall 2017 Outline o Process concept o Process creation o Process states and scheduling o Preemption and context switch o Inter-process communication

More information

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

Announcement. Exercise #2 will be out today. Due date is next Monday Announcement Exercise #2 will be out today Due date is next Monday Major OS Developments 2 Evolution of Operating Systems Generations include: Serial Processing Simple Batch Systems Multiprogrammed Batch

More information

Operating System Architecture. CS3026 Operating Systems Lecture 03

Operating System Architecture. CS3026 Operating Systems Lecture 03 Operating System Architecture CS3026 Operating Systems Lecture 03 The Role of an Operating System Service provider Provide a set of services to system users Resource allocator Exploit the hardware resources

More information

CSE 410: Systems Programming

CSE 410: Systems Programming CSE 410: Systems Programming Pipes and Redirection Ethan Blanton Department of Computer Science and Engineering University at Buffalo Interprocess Communication UNIX pipes are a form of interprocess communication

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

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

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

Introduction to Operating Systems. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Introduction to Operating Systems. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University Introduction to Operating Systems Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Today s Topics What is OS? History of OS 2 What is OS? (1) Application

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

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 to Linux

Introduction to Linux Introduction to Operating Systems All computers that we interact with run an operating system There are several popular operating systems Operating Systems OS consists of a suite of basic software Operating

More information

Assignment 1. Teaching Assistant: Michalis Pachilakis (

Assignment 1. Teaching Assistant: Michalis Pachilakis ( Assignment 1 Teaching Assistant: Michalis Pachilakis ( mipach@csd.uoc.gr) System Calls If a process is running a user program in user mode and needs a system service, such as reading data from a file,

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

Killing Zombies, Working, Sleeping, and Spawning Children

Killing Zombies, Working, Sleeping, and Spawning Children Killing Zombies, Working, Sleeping, and Spawning Children CS 333 Prof. Karavanic (c) 2015 Karen L. Karavanic 1 The Process Model The OS loads program code and starts each job. Then it cleans up afterwards,

More information

Four Components of a Computer System

Four Components of a Computer System Four Components of a Computer System Operating System Concepts Essentials 2nd Edition 1.1 Silberschatz, Galvin and Gagne 2013 Operating System Definition OS is a resource allocator Manages all resources

More information

EECS 470 Lab 5. Linux Shell Scripting. Friday, 1 st February, 2018

EECS 470 Lab 5. Linux Shell Scripting. Friday, 1 st February, 2018 EECS 470 Lab 5 Linux Shell Scripting Department of Electrical Engineering and Computer Science College of Engineering University of Michigan Friday, 1 st February, 2018 (University of Michigan) Lab 5:

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

Operating System Structure

Operating System Structure Operating System Structure Heechul Yun Disclaimer: some slides are adopted from the book authors slides with permission Recap OS needs to understand architecture Hardware (CPU, memory, disk) trends and

More information

Operating System Labs. Yuanbin Wu

Operating System Labs. Yuanbin Wu Operating System Labs Yuanbin Wu cs@ecnu Operating System Labs Introduction to Unix (*nix) Course Overview Operating System Labs Introduction to Unix (*nix) Course Overview Unix / *nix What A family of

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

Overview. Administrative. * HW 2 Grades. * HW 3 Due. Topics: * What are Threads? * Motivating Example : Async. Read() * POSIX Threads

Overview. Administrative. * HW 2 Grades. * HW 3 Due. Topics: * What are Threads? * Motivating Example : Async. Read() * POSIX Threads Overview Administrative * HW 2 Grades * HW 3 Due Topics: * What are Threads? * Motivating Example : Async. Read() * POSIX Threads * Basic Thread Management * User vs. Kernel Threads * Thread Attributes

More information

COS 318: Operating Systems

COS 318: Operating Systems COS 318: Operating Systems OS Structures and System Calls Prof. Margaret Martonosi Computer Science Department Princeton University http://www.cs.princeton.edu/courses/archive/fall11/cos318/ Outline Protection

More information

Introduction to Operating Systems

Introduction to Operating Systems Introduction to Operating Systems Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu EEE3052: Introduction to Operating Systems, Fall 2017, Jinkyu Jeong

More information

Threads, SMP, and Microkernels. Chapter 4

Threads, SMP, and Microkernels. Chapter 4 Threads, SMP, and Microkernels Chapter 4 Processes Resource ownership - process is allocated a virtual address space to hold the process image Dispatched - process is an execution path through one or more

More information

Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - II OS Structures. University at Buffalo. OS Design and Implementation

Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - II OS Structures. University at Buffalo. OS Design and Implementation CSE 421/521 - Operating Systems Fall 2013 Lecture - II OS Structures Tevfik Koşar University at Buffalo August 29 th, 2013 1 Roadmap OS Design and Implementation Different Design Approaches Major OS Components!

More information