Concurrent Architectures - Unix: Sockets, Select & Signals

Size: px
Start display at page:

Download "Concurrent Architectures - Unix: Sockets, Select & Signals"

Transcription

1 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 chars? Overview (Ref: [Coulouris&al Ch 4]): support for concurrency in Unix Berkeley Sockets: protocols: TCP, UDP connection: Ó Ø µ, Ò µ, Ð Ø Ò µ, ÔØ µ, ÓÒÒ Ø µ data transfer Ò µ, Ö Ú µ; advice non-determinism: Ð Ø µ interrupts: motivation, H/W & S/W handling, context soft interrupts (exceptions) and signals; shared memory segments COMP2310 Lecture 21: Operating Systems: Sockets, Select & Signals2014 1

2 creating processes Support for Concurrency in Unix ÓÖ µ and Ü µ (Lab 6, Ass 2) communicating between processes Ô Ô µ (Lab 6) enabling communication between computers sockets (Lab 7, Ass 2) handling non-deterministic events Ð Ø µ (Lab 7, Ass 2) interrupts/signals some other stuff semaphores message queues (not covered in detail) shared memory segments (not covered in detail) COMP2310 Lecture 21: Operating Systems: Sockets, Select & Signals2014 2

3 Berkeley Sockets networking protocol originally provided by BSD 4.1c (1982) API exported by most OS s the principal abstraction is a socket where the application attaches to the network defines operations for creating connections, attaching to network, sending/receiving data and closing connection two forms: connection oriented: Transmission Control Protocol (TCP) connection-less: User Datagram Protocol (UDP) addressing is via an IP address + a port number [Coulouris&al Fig 4.4] COMP2310 Lecture 21: Operating Systems: Sockets, Select & Signals2014 3

4 Connection-oriented and Connection-less Sockets Server Socket() Bind() Client Server Socket() Client Socket() Block until connected Listen() Accept() Establish Connection Socket() Connect() Block until data from client Bind() Recvfrom() Bind() Sendto() Process Request Recv() Send() Send() Recv() Process Request Sendto() Recvfrom() (a) connection-oriented (TCP) (b) connection-less (UDP) COMP2310 Lecture 21: Operating Systems: Sockets, Select & Signals2014 4

5 The Socket Call means by which application attaches to the network ÒØ Ó Ø ÒØ Ñ ÐÝ Ò ØÝÔ ÒØ ÔÖÓØÓÓе Ñ ÐÝ: address family (protocol family) ÍÆÁ, ÁÆÌ, ÆË, ÁÅÈÄÁÆà ØÝÔ : semantics of communication ËÇ Ã ËÇ Ã ËÌÊ Å, ËÇ Ã Ê Ï Ê Å, not all combinations allowed ÔÖÓØÓÓÐ: usually set to 0 but can be set to specific value family and type usually implied by the protocol the return value is a handle (a file descriptor, fd) for the new socket COMP2310 Lecture 21: Operating Systems: Sockets, Select & Signals2014 5

6 The Bind and Listen Calls bind a newly created socket to the specified address ÒØ Ò ÒØ Ó Ø ØÖÙØ Ó Ö Ö ÒØ Ö Ð Òµ Ó Ø: newly created socket handle (fd) Ö : data structure of address of local system IP address and port number same operation for both connection-oriented and connection-less servers can use a well known port or a unique port bunch of routines to convert different forms of address representation (Lab 8) the listen call (server side) used by connection-oriented servers to indicate that an application is willing to receive connections ÒØ Ð Ø Ò ÒØ Ó Ø ÒØ ÐÓ µ Ó Ø: handle (fd) of newly created socket ÐÓ : number of connection requests than can be queued by the system while waiting for server to execute the ÔØ call COMP2310 Lecture 21: Operating Systems: Sockets, Select & Signals2014 6

7 The Accept and Connect Calls the accept call (server side) after the execution of a Ð Ø Ò µ, the accept call carries out a passive opening (server is prepared to accept connects) ÒØ ÔØ ÒØ Ó Ø ØÖÙØ Ó Ö Ö ÒØ Ö Ð Òµ blocks until a remote client carries out a connection request returns with a new socket for the new connection Ö where contains the client s address the connect call (client side) executes an active opening of a connection ÒØ ÓÒÒ Ø Ò Ó Ø ØÖÙØ Ó Ö Ö ÒØ Ö Ð Òµ call does not return until the three-way handshake (TCP) is complete (or an error) Ö : contains remote server s address client OS usually selects a random unused port COMP2310 Lecture 21: Operating Systems: Sockets, Select & Signals2014 7

8 Sockets: Transferring Data & Advice after a connection has been made, Ò µ is used to send a message on a socket: Ò ÒØ Ó Ø Ö Ñ ÒØ Ñ Ð Ò ÒØ Ð µ ÒØ and to receive from a socket into a specified buffer: Ö Ú ÒØ Ó Ø Ö Ù Ö ÒØ Ù Ð Ò ÒØ Ð µ ÒØ advice: read the man pages very carefully for systems you are using use a separate process to implement each protocol applications use buffers as do protocols, copies are expensive, message abstraction aims to minimize this do not use ports<1024, these are reserved for the root demon (server) processes tools and info include netstat, ifconfig, ping, traceroute, /proc, tcpdump etc COMP2310 Lecture 21: Operating Systems: Sockets, Select & Signals2014 8

9 Ø Ø Ö Ù Æ ÓÒÒ Ø ºººµ»» Ó Ø ÓÖ Ö Ò ÒØ Ê Ç ² Ø µ»» Ø ÓÑ Ø ÑÔØÝ Ø Ë Ì ² Ø µ»» ØÓ Ø ººº Ò ººº»» Ñ Ü Ó Ò Ø µ ½ ÒØ Ò ² Ø ÆÍÄÄ ÆÍÄÄ ÆÍÄÄ µ Ð Ø ÁËË Ì ² Ø µµ»» Ø Ú Ð º ÓÒ Non-Determinism: Unix Select the Ð Ø µ system call can blocks on more than one source at a time, waking up when there is information from any of them Ð Ø actually allows you to wait at the same time for messages, events, or write operations compared to Ada select, UNIX select is very messy! (and limited) e.g. wait until any data can be read on any file descriptor in Ø: Ö Ù Æ µ»» Ö ÒØÓ Ù COMP2310 Lecture 21: Operating Systems: Sockets, Select & Signals2014 9

10 interrupt: Non-Determinism: Interrupts and Signals an event external to the currently executing process that causes a change in the normal flow of instruction execution (usually generated by hardware devices external to the CPU) the key issue is that interrupts are asynchronous to current process typically implies that some device needs service an interrupt is a special case of an exception: an event that causes the processor to transition to privileged mode, with control being transferred to the kernel s exception handler code area why interrupts: allow multiple devices to be connected devices need CPU service but the CPU can t predict when external events typically happen on a different timescale compared to CPU want to keep CPU busy between events need a way for CPU to find out a device needs attention alternate solution: polling (why is this bad, when is it good?) COMP2310 Lecture 21: Operating Systems: Sockets, Select & Signals

11 Hardware Interrupt Handling give each device a wire (interrupt line) that it can use to signal the processor when interrupted, the processor executes a routine called an interrupt handler there is no overhead when there are no requests pending CPU Maskable Non-maskable Interrupt Controller Device Device Device Device controller signals CPU that interrupt has occurred, passes interrupt number interrupts are assigned priorities, in order to handle simultaneous interrupts lower priority interrupts may be disabled during service the CPU senses (checks) interrupt request line after every instruction: if raised, uses the interrupt number to determine which handler to start basic (user process) state saved (as for system call) CPU jumps to the interrupt handler when interrupt is done, process state is reloaded and the process resumes COMP2310 Lecture 21: Operating Systems: Sockets, Select & Signals

12 Interrupt Context and Software Handling typically there are two parts to interrupt handling what must be done immediately, so that the device can keep running what can be deferred until later, so that response is faster the first part of an handler records the context from whatever was interrupted the handler is not allowed to block (or call functions that might) the processor (may) have no further structure to save state the handler needs to be kept as fast and simple as possible typically sets up work for second part, and flags that this in turn needs to be handled by asserting the corresponding second-level interrupt the deferred parts of handling are sometimes referred to as software interrupts e.g. networking: time critical: copy incoming packet from the network device deferred: process packet, pass to correct application e.g. timer interrupts: time-critical: increment current time-of-day deferred: recalculate process priorities COMP2310 Lecture 21: Operating Systems: Sockets, Select & Signals

13 Signals software equivalent of (hardware) interrupts allows process or thread to respond to asynchronous external events a process may specify its own signal handlers or may use the OS default action, typically one of: ignore the signal terminate all threads in the process stop or resume all threads in a process signals provide a simple form of inter-process communication basic mechanism: the process state includes flags for possible signals and table for actions to take when a signal is posted to process, the signal pending flag is marked when process is next scheduled to run, pending signals are checked and appropriate action taken signal delivery is not instantaneous COMP2310 Lecture 21: Operating Systems: Sockets, Select & Signals

14 Signal Terminology and Issues posting (aka signal generation, throwing ) action taken when event occurs that process needs to be notified of delivery (aka signal handling) action taken when process recognizes the arrival of an event catching if a user-level signal handler is invoked, process is said to catch the signal pending signals that have been posted but no yet delivered issues: handler may execute at any time need to be careful of manipulating global state in a signal handler signal delivery may interrupt execution of signal handler code should be re-entrant only one signal handler per signal per process (can t use in library code) usually no signal queuing COMP2310 Lecture 21: Operating Systems: Sockets, Select & Signals

15 Ø ÓÒ Ò Û Ø ÓÒ ÓÐ Ø ÓÒ ØÖÙØ Ø ÓÒ º Ò Ð Ö Ò ÒØ Ò Ð Ö Ò Û Signal Usage write a signal handler function to handle ËÁ ÁÆÌ (Ctrl-C from keyboard) Ò ÒØ Ò Ð Ö ÒØ µ{ ÚÓ " I n t e r r u p t e d! \ n " µ ÔÖ ÒØ } ÐÙ Ø ÓÙØ µ install it: block signal delivery by masking signals: ØÑ µ Ø ÓÒ ËÁ ÁÆÌ ² Ò Û Ø ÓÒ ² ÓÐ Ø ÓÒ µ specify that signal handlers run on separate ÐØ Ø µ stack: useful if signal is caused by stack overflow retrieve list of pending ÒÔ Ò Ò µ signals: block process until signal is Ù Ô Ò µ posted: send signal to process: ÐÐ µ COMP2310 Lecture 21: Operating Systems: Sockets, Select & Signals

16 Process Synchronization Using Signals: sigstop.c ÚÓ Ø ØÓÔ ÒØ µ { } " H a n d l e r c a u g h t s i g n a l % d \ n " µ ÔÖ ÒØ Ø ÓÙØ µ Ö ØÙÖÒ ÐÙ Ñ Ò ÒØ Ö Ö Ö Ú µ{ ÒØ Ø ÓÖ µ Ô " H e l l o f r o m P r o c e s s I D % d \ n " ØÔ µµ ÔÖ ÒØ ¼µ { Ø Ø Ò Û Ñ Ø ÓÒ Ò Û Ø ÓÒ ÓÐ Ø ÓÒ ØÖÙØ Ø ÓÒ º Ò Ð Ö Ø ØÓÔ Ò Û ËÁ Ì ÊÅ ² Ò Û Ø ÓÒ ² ÓÐ Ø ÓÒ µ Ø ÓÒ ² Ò Û Ñ µ ÑÔØÝ Ø ² Ò Û Ñ µ Ù Ô Ò " p r o c e s s I D % d : e x i t i n g \ n " ØÔ µµ ÔÖ ÒØ ¼µ Ü Ø Ð } { ½µ Ð Ô ËÁ Ì ÊÅ µ ÐÐ } ÆÍÄÄ µ Û Ø " p r o c e s s I D % d : c h i l d % d h a s e x i t e d \ n " ØÔ µ µ ÔÖ ÒØ COMP2310 Lecture 21: Operating Systems: Sockets, Select & Signals Ö ØÙÖÒ ¼

17 Programming with Signals collect: a Shell script cleans up temporary file when interrupted tmpdir=/tmp/collect.$$ trap cd /tmp; rm -rf $tmpdir; exit exception handling in Java: done via signals arguably a better method than returning error values (e.g. in C system calls) any method that calls another which Ø ÖÓÛ an exception must either Ø it or throw it upwards e.g. SingleLaneBridge.java Û Ø µ or Ì Ö º Ð Ô µ throw an ÁÒØ ÖÖÙÔØ Ü ÔØ ÓÒ the applet s ØÓÔ µ method calls Ì Ö º ÒØ ÖÖÙÔØ µ to stop the threads whenever the number of cars is reset essential that the ÖÙÒ µ method in the car thread Ø s this properly (and then exits) COMP2310 Lecture 21: Operating Systems: Sockets, Select & Signals

18 Shared Memory Segments Process Attach Shared Memory Segment Attach Process a process creates a shared memory segment using Ñ Ø µ the original owner of a shared memory segment can assign (or revoke) ownership to another user with ÑØÐ µ. once created, a shared segment can be attached to a process address space using Ñ Ø µ it can be detached Ñ Ø µ using (see ÑÓÔ µ). the attaching process must have the appropriate permissions once attached, the process can perform normal read or write operations to the segment, as allowed by the permissions a shared segment can be attached multiple times by the same process shared memory segments persist after end of process (!!) COMP2310 Lecture 21: Operating Systems: Sockets, Select & Signals

19 Review: Operating Systems as a Concurrent Architecture process creation by cloning ( ÓÖ µ) with copy-on-write semantics supports parent-child concurrent process relationships limited co-ordination via Û Ø µ; also has Ð Ô µ facility data sharing via copy-on-write (including file descriptors) at start, and transfer via pipes afterwards file descriptor duplication facilitates compound shell commands sockets and pipes uses a byte stream abstraction sockets support a general rendezvous-like communication model has a (limited) select mechanism, used to detect the next receipt of data over several byte streams signals form a limited way for processes to co-ordinate purely a software mechanism: applied when OS next considers the target process for scheduling are also generated via (HW) interrupts or (SW) exceptions special shared memory segments can also be used for process communication COMP2310 Lecture 21: Operating Systems: Sockets, Select & Signals

Overview: Concurrent Architectures - Unix: Forks and Pipes

Overview: Concurrent Architectures - Unix: Forks and Pipes 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,

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

Networks. Other Matters: draft Assignment 2 up (Labs 7 & 8 v. important!!) Ref: [Coulouris&al Ch 3, 4] network performance and principles

Networks. Other Matters: draft Assignment 2 up (Labs 7 & 8 v. important!!) Ref: [Coulouris&al Ch 3, 4] network performance and principles Networks Other Matters: draft Assignment 2 up (Labs 7 & 8 v. important!!) Ref: [Coulouris&al Ch 3, 4] network performance and principles OSI protocol; routing TCP/IP layers and packet organization IP addresses

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

Operating System: Chap13 I/O Systems. National Tsing-Hua University 2016, Fall Semester

Operating System: Chap13 I/O Systems. National Tsing-Hua University 2016, Fall Semester Operating System: Chap13 I/O Systems National Tsing-Hua University 2016, Fall Semester Outline Overview I/O Hardware I/O Methods Kernel I/O Subsystem Performance Application Interface Operating System

More information

3.1 Introduction. Computers perform operations concurrently

3.1 Introduction. Computers perform operations concurrently PROCESS CONCEPTS 1 3.1 Introduction Computers perform operations concurrently For example, compiling a program, sending a file to a printer, rendering a Web page, playing music and receiving e-mail Processes

More information

Hardware OS & OS- Application interface

Hardware OS & OS- Application interface CS 4410 Operating Systems Hardware OS & OS- Application interface Summer 2013 Cornell University 1 Today How my device becomes useful for the user? HW-OS interface Device controller Device driver Interrupts

More information

Chapter 8: I/O functions & socket options

Chapter 8: I/O functions & socket options Chapter 8: I/O functions & socket options 8.1 Introduction I/O Models In general, there are normally two phases for an input operation: 1) Waiting for the data to arrive on the network. When the packet

More information

ECE 650 Systems Programming & Engineering. Spring 2018

ECE 650 Systems Programming & Engineering. Spring 2018 ECE 650 Systems Programming & Engineering Spring 2018 User Space / Kernel Interaction Tyler Bletsch Duke University Slides are adapted from Brian Rogers (Duke) Operating System Services User and other

More information

Lecture 7: Signals and Events. CSC 469H1F Fall 2006 Angela Demke Brown

Lecture 7: Signals and Events. CSC 469H1F Fall 2006 Angela Demke Brown Lecture 7: Signals and Events CSC 469H1F Fall 2006 Angela Demke Brown Signals Software equivalent of hardware interrupts Allows process to respond to asynchronous external events (or synchronous internal

More information

Interprocess Communication Mechanisms

Interprocess Communication Mechanisms Interprocess Communication 1 Interprocess Communication Mechanisms shared storage These mechanisms have already been covered. examples: shared virtual memory shared files processes must agree on a name

More information

shared storage These mechanisms have already been covered. examples: shared virtual memory message based signals

shared storage These mechanisms have already been covered. examples: shared virtual memory message based signals Interprocess Communication 1 Interprocess Communication Mechanisms shared storage These mechanisms have already been covered. examples: shared virtual memory shared files processes must agree on a name

More information

Operating Systems. Review ENCE 360

Operating Systems. Review ENCE 360 Operating Systems Review ENCE 360 High level Concepts What are three conceptual pieces fundamental to operating systems? High level Concepts What are three conceptual pieces fundamental to operating systems?

More information

Memory-Mapped Files. generic interface: vaddr mmap(file descriptor,fileoffset,length) munmap(vaddr,length)

Memory-Mapped Files. generic interface: vaddr mmap(file descriptor,fileoffset,length) munmap(vaddr,length) File Systems 38 Memory-Mapped Files generic interface: vaddr mmap(file descriptor,fileoffset,length) munmap(vaddr,length) mmap call returns the virtual address to which the file is mapped munmap call unmaps

More information

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

PROCESS CONCEPTS. Process Concept Relationship to a Program What is a Process? Process Lifecycle Process Management Inter-Process Communication 2. [03] PROCESSES 1. 1 OUTLINE Process Concept Relationship to a Program What is a Process? Process Lifecycle Creation Termination Blocking Process Management Process Control Blocks Context Switching Threads

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

The control of I/O devices is a major concern for OS designers

The control of I/O devices is a major concern for OS designers Lecture Overview I/O devices I/O hardware Interrupts Direct memory access Device dimensions Device drivers Kernel I/O subsystem Operating Systems - June 26, 2001 I/O Device Issues The control of I/O devices

More information

Models, Notation, Goals

Models, Notation, Goals Scope Ë ÕÙ Ò Ð Ò ÐÝ Ó ÝÒ Ñ ÑÓ Ð Ü Ô Ö Ñ Ö ² Ñ ¹Ú ÖÝ Ò Ú Ö Ð Ö ÒÙÑ Ö Ð ÔÓ Ö ÓÖ ÔÔÖÓÜ Ñ ÓÒ ß À ÓÖ Ð Ô Ö Ô Ú ß Ë ÑÙÐ ÓÒ Ñ Ó ß ËÑÓÓ Ò ² Ö Ò Ö Ò Ô Ö Ñ Ö ÑÔÐ ß Ã ÖÒ Ð Ñ Ó ÚÓÐÙ ÓÒ Ñ Ó ÓÑ Ò Ô Ö Ð Ð Ö Ò Ð ÓÖ Ñ

More information

ELEC / COMP 177 Fall Some slides from Kurose and Ross, Computer Networking, 5 th Edition

ELEC / COMP 177 Fall Some slides from Kurose and Ross, Computer Networking, 5 th Edition ELEC / COMP 177 Fall 2014 Some slides from Kurose and Ross, Computer Networking, 5 th Edition Project #1 Starts in one week Is your Linux environment all ready? Bring your laptop Work time after quick

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

CS 351 Week 15. Course Review

CS 351 Week 15. Course Review CS 351 Week 15 Course Review Objectives: 1. To review the contents from different weeks. 2. To have a complete understanding of important concepts from different weeks. Concepts: 1. Important Concepts

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

ECEN 449 Microprocessor System Design. Hardware-Software Communication. Texas A&M University

ECEN 449 Microprocessor System Design. Hardware-Software Communication. Texas A&M University ECEN 449 Microprocessor System Design Hardware-Software Communication 1 Objectives of this Lecture Unit Learn basics of Hardware-Software communication Memory Mapped I/O Polling/Interrupts 2 Motivation

More information

Interprocess Communication Mechanisms

Interprocess Communication Mechanisms Interprocess Communication 1 Interprocess Communication Mechanisms shared storage shared virtual memory shared files message-based sockets pipes signals Interprocess Communication 2 Message Passing Indirect

More information

Interprocess Communication Mechanisms

Interprocess Communication Mechanisms Interprocess Communication 1 Interprocess Communication Mechanisms shared storage shared virtual memory shared files message-based sockets pipes signals... Interprocess Communication 2 Message Passing

More information

Control-Flow Graph and. Local Optimizations

Control-Flow Graph and. Local Optimizations Control-Flow Graph and - Part 2 Department of Computer Science and Automation Indian Institute of Science Bangalore 560 012 NPTEL Course on Principles of Compiler Design Outline of the Lecture What is

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

CSE/EE 461 Lecture 14. Connections. Last Time. This Time. We began on the Transport layer. Focus How do we send information reliably?

CSE/EE 461 Lecture 14. Connections. Last Time. This Time. We began on the Transport layer. Focus How do we send information reliably? CSE/EE 461 Lecture 14 Connections Last Time We began on the Transport layer Focus How do we send information reliably? Topics ARQ and sliding windows Application Presentation Session Transport Network

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. Johan Montelius KTH

Processes. Johan Montelius KTH Processes Johan Montelius KTH 2017 1 / 47 A process What is a process?... a computation a program i.e. a sequence of operations a set of data structures a set of registers means to interact with other

More information

What is an Operating System? A Whirlwind Tour of Operating Systems. How did OS evolve? How did OS evolve?

What is an Operating System? A Whirlwind Tour of Operating Systems. How did OS evolve? How did OS evolve? What is an Operating System? A Whirlwind Tour of Operating Systems Trusted software interposed between the hardware and application/utilities to improve efficiency and usability Most computing systems

More information

An Esterel Virtual Machine

An Esterel Virtual Machine An Esterel Virtual Machine Stephen A. Edwards Columbia University Octopi Workshop Chalmers University of Technology Gothenburg, Sweden December 28 An Esterel Virtual Machine Goal: Run big Esterel programs

More information

by I.-C. Lin, Dept. CS, NCTU. Textbook: Operating System Concepts 8ed CHAPTER 13: I/O SYSTEMS

by I.-C. Lin, Dept. CS, NCTU. Textbook: Operating System Concepts 8ed CHAPTER 13: I/O SYSTEMS by I.-C. Lin, Dept. CS, NCTU. Textbook: Operating System Concepts 8ed CHAPTER 13: I/O SYSTEMS Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests

More information

Process Scheduling Queues

Process Scheduling Queues Process Control Process Scheduling Queues Job queue set of all processes in the system. Ready queue set of all processes residing in main memory, ready and waiting to execute. Device queues set of processes

More information

Processes and Threads

Processes and Threads OPERATING SYSTEMS CS3502 Spring 2018 Processes and Threads (Chapter 2) Processes Two important types of dynamic entities in a computer system are processes and threads. Dynamic entities only exist at execution

More information

A process. the stack

A process. the stack A process Processes Johan Montelius What is a process?... a computation KTH 2017 a program i.e. a sequence of operations a set of data structures a set of registers means to interact with other processes

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

Lecture 15: I/O Devices & Drivers

Lecture 15: I/O Devices & Drivers CS 422/522 Design & Implementation of Operating Systems Lecture 15: I/O Devices & Drivers Zhong Shao Dept. of Computer Science Yale University Acknowledgement: some slides are taken from previous versions

More information

CSCE Introduction to Computer Systems Spring 2019

CSCE Introduction to Computer Systems Spring 2019 CSCE 313-200 Introduction to Computer Systems Spring 2019 Processes Dmitri Loguinov Texas A&M University January 24, 2019 1 Chapter 3: Roadmap 3.1 What is a process? 3.2 Process states 3.3 Process description

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

What s an API? Do we need standardization?

What s an API? Do we need standardization? Network Interface z The network protocol stack is a part of the OS z Need an API to interface applications to the protocol stack. What s an API? Do we need standardization? z The socket interface is the

More information

Interprocess Communication

Interprocess Communication Interprocess Communication Reading: Silberschatz chapter 4 Additional Reading: Stallings chapter 6 EEL 358 1 Outline Introduction Shared memory systems POSIX shared memory Message passing systems Direct

More information

A Client-Server Exchange

A Client-Server Exchange Socket programming A Client-Server Exchange A server process and one or more client processes Server manages some resource. Server provides service by manipulating resource for clients. 1. Client sends

More information

CSE 153 Design of Operating Systems

CSE 153 Design of Operating Systems CSE 153 Design of Operating Systems Winter 19 Lecture 3: OS model and Architectural Support Last time/today Historic evolution of Operating Systems (and computing!) Today: We start our journey in exploring

More information

Introduction. Interprocess communication. Terminology. Shared Memory versus Message Passing

Introduction. Interprocess communication. Terminology. Shared Memory versus Message Passing Introduction Interprocess communication Cooperating processes need to exchange information, as well as synchronize with each other, to perform their collective task(s). The primitives discussed earlier

More information

Systems Programming and Computer Architecture ( ) Timothy Roscoe

Systems Programming and Computer Architecture ( ) Timothy Roscoe Systems Group Department of Computer Science ETH Zürich Systems Programming and Computer Architecture (252-0061-00) Timothy Roscoe Herbstsemester 2016 AS 2016 Exceptions 1 17: Exceptions Computer Architecture

More information

Process Description and Control

Process Description and Control Process Description and Control 1 Process:the concept Process = a program in execution Example processes: OS kernel OS shell Program executing after compilation www-browser Process management by OS : Allocate

More information

Operating Systems 2010/2011

Operating Systems 2010/2011 Operating Systems 2010/2011 Input/Output Systems part 1 (ch13) Shudong Chen 1 Objectives Discuss the principles of I/O hardware and its complexity Explore the structure of an operating system s I/O subsystem

More information

UNIX Sockets. Developed for the Azera Group By: Joseph D. Fournier B.Sc.E.E., M.Sc.E.E.

UNIX Sockets. Developed for the Azera Group By: Joseph D. Fournier B.Sc.E.E., M.Sc.E.E. UNIX Sockets Developed for the Azera Group By: Joseph D. Fournier B.Sc.E.E., M.Sc.E.E. Socket and Process Communication application layer User Process Socket transport layer (TCP/UDP) network layer (IP)

More information

CSE398: Network Systems Design

CSE398: Network Systems Design CSE398: Network Systems Design Instructor: Dr. Liang Cheng Department of Computer Science and Engineering P.C. Rossin College of Engineering & Applied Science Lehigh University February 23, 2005 Outline

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

Chapter 13: I/O Systems. Operating System Concepts 9 th Edition

Chapter 13: I/O Systems. Operating System Concepts 9 th Edition Chapter 13: I/O Systems Silberschatz, Galvin and Gagne 2013 Chapter 13: I/O Systems Overview I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations

More information

I/O Systems. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic)

I/O Systems. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic) I/O Systems Amir H. Payberah amir@sics.se Amirkabir University of Technology (Tehran Polytechnic) Amir H. Payberah (Tehran Polytechnic) I/O Systems 1393/9/15 1 / 57 Motivation Amir H. Payberah (Tehran

More information

Ausgewählte Betriebssysteme - Mark Russinovich & David Solomon (used with permission of authors)

Ausgewählte Betriebssysteme - Mark Russinovich & David Solomon (used with permission of authors) Outline Windows 2000 - The I/O Structure Ausgewählte Betriebssysteme Institut Betriebssysteme Fakultät Informatik Components of I/O System Plug n Play Management Power Management I/O Data Structures File

More information

CSEP 561 Connections. David Wetherall

CSEP 561 Connections. David Wetherall CSEP 561 Connections David Wetherall djw@cs.washington.edu Connections Focus How do we (reliably) connect processes? This is the transport layer Topics Naming processes Connection setup / teardown Sliding

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

Ancillary Software Development at GSI. Michael Reese. Outline: Motivation Old Software New Software

Ancillary Software Development at GSI. Michael Reese. Outline: Motivation Old Software New Software Ancillary Software Development at GSI Michael Reese Outline: Motivation Old Software New Software Work supported by BMBF NuSTAR.DA - TP 6, FKZ: BMBF 05P12RDFN8 (TP 6). March 20, 2013 AGATA week 2013 at

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

Blocking System Calls in KRoC/Linux

Blocking System Calls in KRoC/Linux Communicating Process Architectures 2 P.H. Welch and A.W.P. Bakkers (Eds.) IOS Press, 2 155 Blocking System Calls in KRoC/Linux Frederick R.M. Barnes Computing Laboratory, University of Kent, Canterbury,

More information

Computer Architecture CS 355 Busses & I/O System

Computer Architecture CS 355 Busses & I/O System Computer Architecture CS 355 Busses & I/O System Text: Computer Organization & Design, Patterson & Hennessy Chapter 6.5-6.6 Objectives: During this class the student shall learn to: Describe the two basic

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

Administrivia. p. 1/20

Administrivia. p. 1/20 p. 1/20 Administrivia Please say your name if you answer a question today If we don t have a photo of you yet, stay after class If you didn t get test email, let us know p. 2/20 Program A int flag1 = 0,

More information

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

Part V. Process Management. Sadeghi, Cubaleska RUB Course Operating System Security Memory Management and Protection Part V Process Management Sadeghi, Cubaleska RUB 2008-09 Course Operating System Security Memory Management and Protection Roadmap of Chapter 5 Notion of Process and Thread Data Structures Used to Manage

More information

CS 5460/6460 Operating Systems

CS 5460/6460 Operating Systems CS 5460/6460 Operating Systems Fall 2009 Instructor: Matthew Flatt Lecturer: Kevin Tew TAs: Bigyan Mukherjee, Amrish Kapoor 1 Join the Mailing List! Reminders Make sure you can log into the CADE machines

More information

CSE 153 Design of Operating Systems Fall 18

CSE 153 Design of Operating Systems Fall 18 CSE 153 Design of Operating Systems Fall 18 Lecture 2: OS model and Architectural Support Last time/today l Historic evolution of Operating Systems (and computing!) l Today: We start our journey in exploring

More information

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

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

Noorul Islam College Of Engineering, Kumaracoil MCA Degree Model Examination (October 2007) 5 th Semester MC1642 UNIX Internals 2 mark Questions Noorul Islam College Of Engineering, Kumaracoil MCA Degree Model Examination (October 2007) 5 th Semester MC1642 UNIX Internals 2 mark Questions 1. What are the different parts of UNIX system? i. Programs

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

Chapter 4: Threads. Overview Multithreading Models Thread Libraries Threading Issues Operating System Examples Windows XP Threads Linux Threads

Chapter 4: Threads. Overview Multithreading Models Thread Libraries Threading Issues Operating System Examples Windows XP Threads Linux Threads Chapter 4: Threads Overview Multithreading Models Thread Libraries Threading Issues Operating System Examples Windows XP Threads Linux Threads Chapter 4: Threads Objectives To introduce the notion of a

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

NETWORK PROGRAMMING. Instructor: Junaid Tariq, Lecturer, Department of Computer Science

NETWORK PROGRAMMING. Instructor: Junaid Tariq, Lecturer, Department of Computer Science NETWORK PROGRAMMING CSC- 341 25 Instructor: Junaid Tariq, Lecturer, Department of Computer Science 26 9 Lecture Sockets as means for inter-process communication (IPC) application layer Client Process Socket

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

Processes. Dr. Yingwu Zhu

Processes. Dr. Yingwu Zhu Processes Dr. Yingwu Zhu Process Growing Memory Stack expands automatically Data area (heap) can grow via a system call that requests more memory - malloc() in c/c++ Entering the kernel (mode) Hardware

More information

I/O Handling. ECE 650 Systems Programming & Engineering Duke University, Spring Based on Operating Systems Concepts, Silberschatz Chapter 13

I/O Handling. ECE 650 Systems Programming & Engineering Duke University, Spring Based on Operating Systems Concepts, Silberschatz Chapter 13 I/O Handling ECE 650 Systems Programming & Engineering Duke University, Spring 2018 Based on Operating Systems Concepts, Silberschatz Chapter 13 Input/Output (I/O) Typical application flow consists of

More information

Linux Driver and Embedded Developer

Linux Driver and Embedded Developer Linux Driver and Embedded Developer Course Highlights The flagship training program from Veda Solutions, successfully being conducted from the past 10 years A comprehensive expert level course covering

More information

What is a Process. Processes. Programs and Processes. System Classification 3/5/2013. Process: An execution stream and its associated state

What is a Process. Processes. Programs and Processes. System Classification 3/5/2013. Process: An execution stream and its associated state What is a Process Process: An execution stream and its associated state Processes Execution Stream Set of instructions Thread of control Process State Hardware state Privilege level, segments, page tables

More information

Other Interprocess communication (Chapter 2.3.8, Tanenbaum)

Other Interprocess communication (Chapter 2.3.8, Tanenbaum) Other Interprocess communication (Chapter 2.3.8, Tanenbaum) IPC Introduction Cooperating processes need to exchange information, as well as synchronize with each other, to perform their collective task(s).

More information

Chapter 2 Applications and

Chapter 2 Applications and Chapter 2 Applications and Layered Architectures Sockets Socket API API (Application Programming Interface) Provides a standard set of functions that can be called by applications Berkeley UNIX Sockets

More information

CS 326: Operating Systems. Networking. Lecture 17

CS 326: Operating Systems. Networking. Lecture 17 CS 326: Operating Systems Networking Lecture 17 Today s Schedule Project 3 Overview, Q&A Networking Basics Messaging 4/23/18 CS 326: Operating Systems 2 Today s Schedule Project 3 Overview, Q&A Networking

More information

Probabilistic analysis of algorithms: What s it good for?

Probabilistic analysis of algorithms: What s it good for? Probabilistic analysis of algorithms: What s it good for? Conrado Martínez Univ. Politècnica de Catalunya, Spain February 2008 The goal Given some algorithm taking inputs from some set Á, we would like

More information

SMD149 - Operating Systems

SMD149 - Operating Systems SMD149 - Operating Systems Roland Parviainen November 3, 2005 1 / 45 Outline Overview 2 / 45 Process (tasks) are necessary for concurrency Instance of a program in execution Next invocation of the program

More information

Computer architecture. A simplified model

Computer architecture. A simplified model Computer architecture A simplified model Computers architecture One (or several) CPU(s) Main memory A set of devices (peripherals) Interrupts Direct memory access Computers architecture Memory Keyboard

More information

Outline. Threads. Single and Multithreaded Processes. Benefits of Threads. Eike Ritter 1. Modified: October 16, 2012

Outline. Threads. Single and Multithreaded Processes. Benefits of Threads. Eike Ritter 1. Modified: October 16, 2012 Eike Ritter 1 Modified: October 16, 2012 Lecture 8: Operating Systems with C/C++ School of Computer Science, University of Birmingham, UK 1 Based on material by Matt Smart and Nick Blundell Outline 1 Concurrent

More information

Signal Example 1. Signal Example 2

Signal Example 1. Signal Example 2 Signal Example 1 #include #include void ctrl_c_handler(int tmp) { printf("you typed CTL-C, but I don't want to die!\n"); int main(int argc, char* argv[]) { long i; signal(sigint, ctrl_c_handler);

More information

CHETTINAD COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF MCA QUESTION BANK UNIT 1

CHETTINAD COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF MCA QUESTION BANK UNIT 1 CHETTINAD COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF MCA QUESTION BANK SUBJECT: NETWORK PROGRAMMING/MC9241 YEAR/ SEM: II /I V 1 CCET UNIT 1 1. What are the steps involved in obtaining a shared

More information

Chapter 4: Multithreaded Programming

Chapter 4: Multithreaded Programming Chapter 4: Multithreaded Programming Silberschatz, Galvin and Gagne 2013! Chapter 4: Multithreaded Programming Overview Multicore Programming Multithreading Models Threading Issues Operating System Examples

More information

Application Programming Interfaces

Application Programming Interfaces Application Programming Interfaces The TCP/IP protocol suite provides only the protocols that can be used by processes to communicate across a network. Though standarized, how these protocols are implemented

More information

PROCESS CONTROL BLOCK TWO-STATE MODEL (CONT D)

PROCESS CONTROL BLOCK TWO-STATE MODEL (CONT D) MANAGEMENT OF APPLICATION EXECUTION PROCESS CONTROL BLOCK Resources (processor, I/O devices, etc.) are made available to multiple applications The processor in particular is switched among multiple applications

More information

ELEC 377 Operating Systems. Week 1 Class 2

ELEC 377 Operating Systems. Week 1 Class 2 Operating Systems Week 1 Class 2 Labs vs. Assignments The only work to turn in are the labs. In some of the handouts I refer to the labs as assignments. There are no assignments separate from the labs.

More information

The Kernel Abstraction

The Kernel Abstraction The Kernel Abstraction Debugging as Engineering Much of your time in this course will be spent debugging In industry, 50% of software dev is debugging Even more for kernel development How do you reduce

More information

Lecture 5: Process Description and Control Multithreading Basics in Interprocess communication Introduction to multiprocessors

Lecture 5: Process Description and Control Multithreading Basics in Interprocess communication Introduction to multiprocessors Lecture 5: Process Description and Control Multithreading Basics in Interprocess communication Introduction to multiprocessors 1 Process:the concept Process = a program in execution Example processes:

More information

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

Multiprogramming. Evolution of OS. Today. Comp 104: Operating Systems Concepts 28/01/2013. Processes Management Scheduling & Resource Allocation Comp 104: Operating Systems Concepts Management Scheduling & Resource Allocation Today OS evolution Introduction to processes OS structure 1 2 Evolution of OS Largely driven by desire to do something useful

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

CHAPTER 11 INTERRUPTS PROGRAMMING

CHAPTER 11 INTERRUPTS PROGRAMMING CHAPTER 11 INTERRUPTS PROGRAMMING Interrupts vs. Polling An interrupt is an external or internal event that interrupts the microcontroller To inform it that a device needs its service A single microcontroller

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

CSEP 561 Connections. David Wetherall

CSEP 561 Connections. David Wetherall CSEP 561 Connections David Wetherall djw@cs.washington.edu Connections Focus How do we (reliably) connect processes? This is the transport layer Topics Naming processes TCP / UDP Connection setup / teardown

More information

Asynchronous Events on Linux

Asynchronous Events on Linux Asynchronous Events on Linux Frederic.Rossi@Ericsson.CA Open System Lab Systems Research June 25, 2002 Ericsson Research Canada Introduction Linux performs well as a general purpose OS but doesn t satisfy

More information

Transport Layer (TCP/UDP)

Transport Layer (TCP/UDP) Transport Layer (TCP/UDP) Where we are in the Course Moving on up to the Transport Layer! Application Transport Network Link Physical CSE 461 University of Washington 2 Recall Transport layer provides

More information

UNIT -3 PROCESS AND OPERATING SYSTEMS 2marks 1. Define Process? Process is a computational unit that processes on a CPU under the control of a scheduling kernel of an OS. It has a process structure, called

More information