Open System Services. Developer's Tips. Marc Fuentes and Milind Dattawadkar

Size: px
Start display at page:

Download "Open System Services. Developer's Tips. Marc Fuentes and Milind Dattawadkar"

Transcription

1 Open System Services (OSS) Update and OSS Developer's Tips Marc Fuentes and Milind Dattawadkar 2010 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice

2 AGENDA Recent enhancements AF_UNIX Release 2 OSS Limits Lifting POSIX User Threads Migration considerations Upcoming enhancements 64-bit OSS Processes Additional OSS Limits Lifting FLOSS and Open Source Utilities 2

3 AF_UNIX Release 2 Overview Completely re-architectured implementation of AF_UNIX sockets on OSS Many fewer moving parts API compatibility with AF_UNIX Release 1 (the earlier implementation) AF_UNIX Release 2 totally replaces AF_UNIX Release 1 Benefits Increased reliability and robustness Increased performance Availability AF_UNIX Release 2 is installed automatically when H06.16/J06.05 or later SUT is installed. $ZPMON.#ZPLS remains in the OSS Monitor s Database for fall-back to earlier versions 3

4 OSS Limits Lifting Overview More OSS file opens (64,000 opens per CPU) 48,000 disk opens; 16,000 sockets; 16,000 pipes More memory for file IO operations (> 100 MB per CPU) 60 MB disk cache; 32 MB sockets; 32 MB pipes Efficient memory allocation for file IO operations Resource usage EMS events Significant state changes and Failures Benefits Increased scalability Efficient use of memory Enhanced manageability Availability Automatically present and enabled when H06.18/J06.07 or later SUT is installed 4

5 POSIX User Threads Overview Thread-aware version of NSK public DLLs allow multi-threaded programs to safely execute non-blocking library I/O functions and functions that share context. Stack overflow detection provides protected memory: process signal stack, and protected thread stacks. It allows an OSS process to enable a signal handler to catch stack overflow traps (SIGSTK). Benefits Improved performance for threaded applications Improved robustness in applications (Stack overflow detection) Improved POSIX standard compliance Availability Available when H06.21/J06.10 or later SUT is installed Applications need to be rebuilt with T1280, the POSIX User Thread (PUT) library Certain applications may need modifications 5

6 AF_UNIX Release 2 features Relesase 1 (compatibility) and Release 2 (portability) mode behavioral differences (1 of 3) Release 1: getpeername() returns the relative pathname of the peer socket when bind() was given a relative pathname. Release 2: getpeername() returns the fully-qualified equivalent of the relative pathname of the peer socket when bind() was given a relative pathname. Release 1 Datagram sockets: getpeername() returns ENOENT when the peer socket file has been renamed Release 2 Datagram sockets: getpeername() returns the fully qualified name of the socket file given to connect() Release 1 Datagram sockets: getpeername() returns ENOENT when the peer socket file has been unlinked Release 2 Datagram sockets: getpeername() returns the fully qualified name of the socket file given to connect() 6

7 AF_UNIX Release 2 features Release 1 (compatibility) and Release 2 (portability) mode differences (2 of 3) Release 1 receivefrom()/receivemsg(): When the file to which a sending datagram socket is bound is removed and one of the send family of functions is called, the receiving client s call to recvfrom() or recvmsg() returns a null address (all fields in the address are zero). Release 2 receivefrom()/receivemsg(): When the file to which a sending datagram socket is bound is removed and one of the send family of functions is called, the receiving client s call to recvfrom() or recvmsg() returns the fully-qualified form of the address to which the sending socket was originally bound. Release 1 connect(): If listen() is called with a backlog <= 0, subsequent attempts to connect to the socket are rejected with ECONNREFUSED unless there is a pending accept() call on the socket. Release 2 connect(): If listen() is called with a backlog <= 0, subsequent attempts to connect to the socket block until there is a corresponding accept() call on the socket. 7

8 AF_UNIX Release 2 features Release 1 (compatibility) and Release 2 (portability) mode differences (3 of 3) Release 1 getsockname(): When a bound socket file is unlinked or renamed, a subsequent call to getsockname() fails with ENOENT. Release 2 getsockname(): When a bound socket file is unlinked or renamed, a subsequent call to getsockname() still returns the fully qualified name. 8

9 AF_UNIX Release 2 features Specifying Release 1 (compatibility mode) or Release 2 (portability mode) behavior Processes can use both Release 1 and Release 2 sockets concurrently Sockets created in one mode cannot interact with sockets created in a different mode (connect() fails with ECONNREFUSED, sendto()/sendmsg() fails with EPERM) The default mode is Release 1 (compatibility mode) Changing the mode only affects the calling process and child processes, it does not change the mode for all present/future processes on the system The =_AFUNIX_PROCESS_NAME File System Define is used to set the default mode for processes that inherit the define Processes can call socket_transport_name_set() to set the mode for the next socket the process creates. 9

10 AF_UNIX Release 2 Operations and Management Operations and usage LS2 processes may be stopped for replacement. SCF STOP SERVER $ZPMON.#ZLSnn If there are AF_UNIX sockets in the CPU, the operation fails: 1-> assume process $zpmon 2-> stop server #zls00 OSS E00030 Failed to stop server $ZLS00 3-> 10

11 AF_UNIX Release 2 features Selecting Release 1 behavior (compatibility mode) TACL (note that $ZPLS is not an actual process name under AF_UNIX Release 2) ADD DEFINE =_AFUNIX_PROCESS_NAME, CLASS MAP, FILE $ZPLS OSS shell add_define =_AFUNIX_PROCESS_NAME class=map file=\$zpls Programmatically if (DEFINESETATTR( CLASS<blank-padded-for11-bytes>, MAP,3) exit(-1); if(definesetattr( FILE<blank-paded-for-12-bytes, $ZPLS,5) exit(-1); if(2051 == DEFINEADD( =_AFUNIX_PROCESS_NAME<blank-padded-for3-bytes>,1)) if(defineadd( =_AF_UNIX_PROCESS_NAME<blank-padded-for-3-bytes>,0) exit(-1); Dynamically #define _XOPEN_SOURCE_EXTENDED 1 #include <sys/socket.h> If(socket_transport_name_set(AF_UNIX, $ZPLS )) exit(-1); 11

12 AF_UNIX Release 2 features Selecting Release 2 behavior (portability mode) TACL (note that $ZAFN2 is not an actual process name under AF_UNIX Release 2) ADD DEFINE =_AFUNIX_PROCESS_NAME, CLASS MAP, FILE $ZAFN2 OSS shell add_define =_AFUNIX_PROCESS_NAME class=map file=\$zafn2 Programmatically if(definesetattr( CLASS<blank-padded-for11-bytes>, MAP,3) exit(-1); if(definesetattr( FILE<blank-paded-for-12-bytes, $ZAFN2,6) exit(-1); if(2051 == DEFINEADD( =_AFUNIX_PROCESS_NAME<blank-padded-for3-bytes>,1)) if(defineadd( =_AF_UNIX_PROCESS_NAME<blank-padded-for-3-bytes>,0) exit(-1); Dynamically #define _XOPEN_SOURCE_EXTENDED 1 #include <sys/socket.h> if(socket_transportname_set(af_unix, $ZAFN2 )) exit(-1); 12

13 OSS Limits Lifting New EMS events Resources monitored POB open table, PXS buffers, socket open table, socket buffers, pipe open table, pipe buffers, disk opens, disk cache buffers Event types Limit warning (When 85% of the resource has been allocated) Limit error (When 100% of the resource has been allocated) Status normal (When the resource usage falls to or below 65%) Allocation error (When the resource cannot be allocated for some other reason) 13

14 OSS Limits Lifting New EMS events Limit warning event example :00:18 \YOSQA26.$ZPP01 TANDEM.OSS.H Resource PIPEFIFO BUFS is approaching the resource limit. Resource limit: Warning threshold: 85 Current percentage: 85 Current usage: Peak percentage: 100 Peak usage: Peak time: 28JAN09 18:55 Reset time: 28JAN09 16:05 Safe threshold: 65 14

15 OSS Limits Lifting New EMS events Limit error event example :00:33 \YOSQA26.$ZPP01 *TANDEM.OSS.H Limit error for PIPEFIFO BUFS resource. Resource limit: Current percentage: 100 Current usage: OSS PID: Program file: \YOSQA26.$SYSTEM.SYS52.OSSPS Attempted Allocation Amount:

16 OSS Limits Lifting New EMS events Status normal event example :02:08 \YOSQA26.$ZPP01 TANDEM.OSS.H Status returned to normal for PIPEFIFO BUFS resource. Resource limit: Warning threshold: 85 Safe threshold: 65 Status threshold: 0 Current percentage: 65 Current usage: Peak percentage: 100 Peak usage: Peak time: 28JAN09 18:55 Reset time: 28JAN09 16:05 16

17 OSS Limits Lifting New EMS events Allocation error event example :49:33 \YOSQA26.$ZPP01 *TANDEM.OSS.H Allocation error for PIPEFIFO BUFS resource. Resource limit: Current percentage: 0 Current usage: 0 Peak percentage: 100 Peak usage: Peak time: 28JAN09 18:55 Reset time: 28JAN09 16:05 OSS PID: Program file: \YOSQA26.$SYSTEM.SYS52.OSSPS Attempted Allocation Amount:

18 POSIX User Threads Migrating from the SPT (T1248) library to the PUT library (T1280) Compiler defines Include pthread.h in /usr/include instead of spthread.h #include <pthread.h> Define _PUT_MODEL_ This define is required for threaded applications using the PUT library. It may be specified in the source code as a #define or on the compiler command line with the D switch. Faster select() algorithm Define _PUT_SELECT_SINGLE_ to use a version of select() that is faster. This is equivalent to SPT_SELECT_SINGLE in the SPT library 18

19 POSIX User Threads Migrating from the SPT library to the PUT library Environment variables PUT_THREAD_AWARE_REGULAR_IO_DISABLE Disables thread-aware regular I/O behavior. Thread-aware APIs ignore the O_NONBLOCK flag for regular files. Setting this environment variable before running an application that used the PUT library causes thread-aware APIs to have process blocking behavior. See the Open System Services Programmer s Guide for details. PUT_PROTECTED_STACK_DISABLE Setting this environment variable causes the thread stack to be allocated from the process heap instead of being allocated on a separate protected stack 19

20 POSIX User Threads migration considerations Migrating from the SPT library to the PUT library Mixing the SPT library and the PUT library in the same process is not allowed, attempts to do so fail with runtime error 019 pthread_attr_default, pthread_mutexattr_default, pthread_condattr_default do not exist as global varables in the PUT library The PUT library functions return -1 and set errno rather than returning the errno value. unistd.h has a set of macros that influence HP s thread implementation. See the Open System Services Programmer s Guide for details. Thread-aware signals are always enabled in the PUT library. PUT-based applications have to statically link with the PUT library. 20

21 POSIX User Threads migration considerations Signal handling topics (1 of 3) PUT model applications cannot call sigaltstack() to establish a signal stack. They can call sigaltstack() to find the information about the signal stack. The Open System Services Programmer s Guide lists a set of functions that are not async-signal safe. These functions should not be used in signal handlers (this is similar to the SPT library). Job control signals and their corresponding actions are not supported (this is similar to the SPT library). The Real-time Signals Extension option is not supported (this is similar to the SPT library). signal() is deprecated, use sigaction() instead See the Open System Services Programmer s Guide for a list of APIs that support thread-aware signal handling 21

22 POSIX User Threads migration considerations Signal handling topics (2 of 3) Similar to the SPT library Some signals affect the entire process. See the Open System Services Programmer s Guide for details If a signal is delivered to a thread waiting on a condition variable, then upon return from the signal handler, the thread will resume waiting for the condition variable as if it were not interrupted. Do not use the raise() API for an exception, and do not use the longjmp() API to exit a synchronous signal handler. Simply returning from a signal handler is safe and is the recommended practice. Use exception handlers instead of the setjmp() and longjmp() APIs for threaded OSS applications. Do not use the option of the sigsetjmp() and siglongjmp() APIs that saves and restores the signal mask. Doing so can cause signals enabled by another thread to be masked. 22

23 POSIX User Threads migration considerations Signal handling topics (3 of 3) Do not deliver signals like SIGALRM and SIGCHLD using the kill command or the raise() function because these do not provide enough information about the process IDs for the parent and child processes. Instead, use the PUT Model library version of the alarm() API to raise alarms. 23

24 POSIX User Threads migration considerations APIs in the SPT library that do not exist in the PUT library The PUT model library does not provide analogs to spt_*x() or spt_*z() APIs, such as spt_readx() or spt_readz(), whose purpose is to be non-blocking alternatives to standard system library functions. Instead, use the standard API names. The PUT model library does not provide analogs to spt_*() functions, such as spt_fprintf(), whose purpose is to be non-blocking alternatives to the standard C run-time library functions. Instead, use the standard API names. The C run-time library functions are thread-aware if called from a PUT-based application. 24

25 POSIX User Threads migration considerations Pitfalls See the Open System Services Programmer s Guide for a list of threadaware APIs, a list of non-thread-safe APIs, non-thread-safe cancellation points, and a list of APIs that are potential cancellation points Do not mix modules compiled to use the PUT library with non threadaware modules when the modules perform I/O to the same files Look out for warnings of the form: function <function-name>" declared implicitly, reports that no explicit definition of <function-name>() appeared and therefore the compiler assumed defaults for all function attributes. Consequently, calls to <function-name>() are not aliased to the nonblocking variant and cause an unneeded and unwanted suspension of the entire process. 25

26 Thread-Aware I/O Availability Pre-POSIX User Thread called directly from: Thread-aware system I/O on non-disk file Thread-aware system I/O on disk file Thread-aware C I/O on nondisk file Thread-aware C I/O on disk file Thread-aware C++ I/O streaming SPT-based application Х Х Public DLL linked to SPT-based applications Х Х Х Х Х Post-POSIX User Thread called directly from: Thread-aware system I/O on non-disk file Thread-aware system I/O on disk file Thread-aware C I/O on nondisk file Thread-aware C I/O on disk file Thread-aware C++ I/O streaming Thread-aware public DLL functions SPT-based application Х Х Х Public DLL linked to SPT-based applications Х Х Х Х Х Х PUT-based application Public DLL linked to PUT-based applications 26

27 64 Bit OSS Processes Overview for C/C++ programs Allow OSS programs access to a much larger virtual address space for data through support of 64-bit addressing. SQL/MX Access from processes using 64-bit addressing. Run-time heap in 64-bit addressable virtual memory Benefits Default limit is 12GB NonStop OS limit is.5tb for heap and 64-bit flat segments. Practical limit determined by the amount of RAM and disk space for swap files. Increased scalability Future product plans, dates, and functionality are subject to change without notice. 27

28 Additional OSS Limits Lifting Overview More OSS processes per system 128,000 simultaneous OSS processes on a 16-processor system More OSS file opens (128,000 opens per CPU) 96,000 disk opens; 32,000 sockets; 32,000 pipes; 32,000 ttys More memory for file IO operations 120 MB disk cache; 64 MB sockets; 32 MB pipes Resource monitoring capabilities with SCF commands Resource monitoring capabilities with Measure Benefits Increased scalability Enhanced resource monitoring Future product plans, dates, and functionality are subject to change without notice. 28

29 FLOSS and Open Source Utilities Overview FLOSS - enables porting of open source tools to the NonStop platform At present, FLOSS version 0.9 is available at the Connect website ( This will be made available as a standard product on the RVU Provides select Open Source Tools on the NonStop platform FLOSS will be officially supported Tools made available on a business case by case basis Samba Update tools on the Connect website (BASH, Archival tools, Core utilities, etc.) Provide RPM and RPM based packages on the Connect website to ease installation and dependency management Benefits Enable portability of open source packages Updated tools 29 Future product plans, dates, and functionality are subject to change without notice.

30 S T E Pup the momentum of your technology evolution. HP Integrity NonStop modernization for greater infrastructure convergence

Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2

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

More information

Unix System Programming - Chapter 8

Unix System Programming - Chapter 8 Unix System Programming - Chapter 8 Neal Nelson The Evergreen State College Apr 2010 USP Chapter 8 - Signals Section 8.1 - Basic Signal Concepts Section 8.2 - Generating Signals Section 8.3 - Signal Masks

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

IMPLEMENTATION OF SIGNAL HANDLING. CS124 Operating Systems Fall , Lecture 15

IMPLEMENTATION OF SIGNAL HANDLING. CS124 Operating Systems Fall , Lecture 15 IMPLEMENTATION OF SIGNAL HANDLING CS124 Operating Systems Fall 2017-2018, Lecture 15 2 Signal Handling UNIX operating systems allow es to register for and handle signals Provides exceptional control flow

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

Each terminal window has a process group associated with it this defines the current foreground process group. Keyboard-generated signals are sent to

Each terminal window has a process group associated with it this defines the current foreground process group. Keyboard-generated signals are sent to Each terminal window has a process group associated with it this defines the current foreground process group. Keyboard-generated signals are sent to all processes in the current window s process group.

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

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

THE PROCESS ABSTRACTION. CS124 Operating Systems Winter , Lecture 7

THE PROCESS ABSTRACTION. CS124 Operating Systems Winter , Lecture 7 THE PROCESS ABSTRACTION CS124 Operating Systems Winter 2015-2016, Lecture 7 2 The Process Abstraction Most modern OSes include the notion of a process Term is short for a sequential process Frequently

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

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

Announcements Processes: Part II. Operating Systems. Autumn CS4023

Announcements Processes: Part II. Operating Systems. Autumn CS4023 Operating Systems Autumn 2018-2019 Outline Announcements 1 Announcements 2 Announcements Week04 lab: handin -m cs4023 -p w04 ICT session: Introduction to C programming Outline Announcements 1 Announcements

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

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

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

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

Signals are a kernel-supported mechanism for reporting events to user code and forcing a response to them. There are actually two sorts of such

Signals are a kernel-supported mechanism for reporting events to user code and forcing a response to them. There are actually two sorts of such Signals are a kernel-supported mechanism for reporting events to user code and forcing a response to them. There are actually two sorts of such events, to which we sometimes refer as exceptions and interrupts.

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

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

Overview. Administrative. * HW 1 grades. * HW 2 Due. Topics. * 5.1 What is a Signal? * Dealing with Signals - masks, handlers

Overview. Administrative. * HW 1 grades. * HW 2 Due. Topics. * 5.1 What is a Signal? * Dealing with Signals - masks, handlers Overview Administrative * HW 1 grades * HW 2 Due Topics * 5.1 What is a Signal? * 5.2-3 Dealing with Signals - masks, handlers * 5.4 Synchronization: pause(), sigsuspend() * 5.6 Interaction with other

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

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

A read or write being atomic means that its effect is as if it happens instantaneously.

A read or write being atomic means that its effect is as if it happens instantaneously. A read or write being atomic means that its effect is as if it happens instantaneously. Signals are a kernel-supported mechanism for reporting events to user code and forcing a response to them. There

More information

Chapter 3: Process Concept

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

More information

Chapter 3: Process Concept

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

More information

The Kernel. wants to be your friend

The Kernel. wants to be your friend The Kernel wants to be your friend Boxing them in Buggy apps can crash other apps App 1 App 2 App 3 Operating System Reading and writing memory, managing resources, accessing I/O... Buggy apps can crash

More information

Overview. Last Lecture. This Lecture. Daemon processes and advanced I/O functions

Overview. Last Lecture. This Lecture. Daemon processes and advanced I/O functions Overview Last Lecture Daemon processes and advanced I/O functions This Lecture Unix domain protocols and non-blocking I/O Source: Chapters 15&16&17 of Stevens book Unix domain sockets A way of performing

More information

Motivation of VPN! Overview! VPN addressing and routing! Two basic techniques for VPN! ! How to guarantee privacy of network traffic?!

Motivation of VPN! Overview! VPN addressing and routing! Two basic techniques for VPN! ! How to guarantee privacy of network traffic?! Overview!! Last Lecture!! Daemon processes and advanced I/O functions!! This Lecture!! VPN, NAT, DHCP!! Source: Chapters 19&22 of Comer s book!! Unix domain protocols and non-blocking I/O!! Source: Chapters

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

Chapter 3: Process Concept

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

More information

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

Chapter 4 Multithreaded Programming

Chapter 4 Multithreaded Programming Chapter 4 Multithreaded Programming Da-Wei Chang CSIE.NCKU Source: Abraham Silberschatz, Peter B. Galvin, and Greg Gagne, "Operating System Concepts", 9th Edition, Wiley. 1 1 Outline Overview Multithreading

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

CSci 4061 Introduction to Operating Systems. (Thread-Basics)

CSci 4061 Introduction to Operating Systems. (Thread-Basics) CSci 4061 Introduction to Operating Systems (Thread-Basics) Threads Abstraction: for an executing instruction stream Threads exist within a process and share its resources (i.e. memory) But, thread has

More information

Course Syllabus. Operating Systems, Spring 2016, Meni Adler, Danny Hendler & Amnon Meisels

Course Syllabus. Operating Systems, Spring 2016, Meni Adler, Danny Hendler & Amnon Meisels Course Syllabus 1. Introduction - History; Views; Concepts; Structure 2. Process Management - Processes; State + Resources; Threads; Unix implementation of Processes 3. Scheduling Paradigms; Unix; Modeling

More information

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

Agenda. Threads. Single and Multi-threaded Processes. What is Thread. CSCI 444/544 Operating Systems Fall 2008 Agenda Threads CSCI 444/544 Operating Systems Fall 2008 Thread concept Thread vs process Thread implementation - user-level - kernel-level - hybrid Inter-process (inter-thread) communication What is Thread

More information

CSci 4061 Introduction to Operating Systems. (Advanced Control Signals)

CSci 4061 Introduction to Operating Systems. (Advanced Control Signals) CSci 4061 Introduction to Operating Systems (Advanced Control Signals) What is a Signal? Signals are a form of asynchronous IPC Earlier: Non-blocking I/O and check if it has happened => polling Problem

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

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

Inter-Process Communication and Synchronization of Processes, Threads and Tasks: Lesson-1: PROCESS Inter-Process Communication and Synchronization of Processes, Threads and Tasks: Lesson-1: PROCESS 1 Process Concepts 2 Process A process consists of executable program (codes), state of which is controlled

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

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

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

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

Basic OS Progamming Abstrac7ons

Basic OS Progamming Abstrac7ons Basic OS Progamming Abstrac7ons Don Porter Recap We ve introduced the idea of a process as a container for a running program And we ve discussed the hardware- level mechanisms to transi7on between the

More information

Basic OS Progamming Abstrac2ons

Basic OS Progamming Abstrac2ons Basic OS Progamming Abstrac2ons Don Porter Recap We ve introduced the idea of a process as a container for a running program And we ve discussed the hardware- level mechanisms to transi2on between the

More information

Standards / Extensions C or C++ Dependencies POSIX.1 XPG4 XPG4.2 Single UNIX Specification, Version 3

Standards / Extensions C or C++ Dependencies POSIX.1 XPG4 XPG4.2 Single UNIX Specification, Version 3 read() Read From a File or Socket z/os V1R10.0 XL C/C++ Run-Time Library Reference SA22-7821-10 Standards Standards / Extensions C or C++ Dependencies POSIX.1 XPG4 XPG4.2 Single UNIX Specification, Version

More information

Signals: Management and Implementation. Sanjiv K. Bhatia Univ. of Missouri St. Louis

Signals: Management and Implementation. Sanjiv K. Bhatia Univ. of Missouri St. Louis Signals: Management and Implementation Sanjiv K. Bhatia Univ. of Missouri St. Louis sanjiv@aryabhat.umsl.edu http://www.cs.umsl.edu/~sanjiv Signals Mechanism to notify processes of asynchronous events

More information

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

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

More information

OPERATING SYSTEM. Chapter 4: Threads

OPERATING SYSTEM. Chapter 4: Threads OPERATING SYSTEM Chapter 4: Threads Chapter 4: Threads Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues Operating System Examples Objectives To

More information

Lecture 4 Threads. (chapter 4)

Lecture 4 Threads. (chapter 4) Bilkent University Department of Computer Engineering CS342 Operating Systems Lecture 4 Threads (chapter 4) Dr. İbrahim Körpeoğlu http://www.cs.bilkent.edu.tr/~korpe 1 References The slides here are adapted/modified

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

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

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

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

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

pthreads CS449 Fall 2017

pthreads CS449 Fall 2017 pthreads CS449 Fall 2017 POSIX Portable Operating System Interface Standard interface between OS and program UNIX-derived OSes mostly follow POSIX Linux, macos, Android, etc. Windows requires separate

More information

Concurrent Programming. Alexandre David

Concurrent Programming. Alexandre David Concurrent Programming Alexandre David 1.2.05 adavid@cs.aau.dk Disclaimer Overlap with PSS Threads Processes Scheduling Overlap with MVP Parallelism Thread programming Synchronization But good summary

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

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

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

Dr. Rafiq Zakaria Campus. Maulana Azad College of Arts, Science & Commerce, Aurangabad. Department of Computer Science. Academic Year

Dr. Rafiq Zakaria Campus. Maulana Azad College of Arts, Science & Commerce, Aurangabad. Department of Computer Science. Academic Year Dr. Rafiq Zakaria Campus Maulana Azad College of Arts, Science & Commerce, Aurangabad Department of Computer Science Academic Year 2015-16 MCQs on Operating System Sem.-II 1.What is operating system? a)

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

Processes and Threads

Processes and Threads COS 318: Operating Systems Processes and Threads Kai Li and Andy Bavier Computer Science Department Princeton University http://www.cs.princeton.edu/courses/archive/fall13/cos318 Today s Topics u Concurrency

More information

Chapter 5: Threads. Overview Multithreading Models Threading Issues Pthreads Windows XP Threads Linux Threads Java Threads

Chapter 5: Threads. Overview Multithreading Models Threading Issues Pthreads Windows XP Threads Linux Threads Java Threads Chapter 5: Threads Overview Multithreading Models Threading Issues Pthreads Windows XP Threads Linux Threads Java Threads 5.1 Silberschatz, Galvin and Gagne 2003 More About Processes A process encapsulates

More information

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

System Call. Preview. System Call. System Call. System Call 9/7/2018 Preview Operating System Structure Monolithic Layered System Microkernel Virtual Machine Process Management Process Models Process Creation Process Termination Process State Process Implementation Operating

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

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

Introduction to Computer Systems. Networks 2. c Theodore Norvell. The Sockets API

Introduction to Computer Systems. Networks 2. c Theodore Norvell. The Sockets API The Sockets API [Wait! If you are not familiar with file descriptors and the UNIX read and write system calls, read chapter 10 of Bryant and O Hallaron and/or my summary before going on.] In this section

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

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

Process. Program Vs. process. During execution, the process may be in one of the following states What is a process? What is process scheduling? What are the common operations on processes? How to conduct process-level communication? How to conduct client-server communication? Process is a program

More information

Lesson 3. The func procedure allows a user to choose the action upon receipt of a signal.

Lesson 3. The func procedure allows a user to choose the action upon receipt of a signal. Lesson 3 Signals: When a process terminates abnormally, it usually tries to send a signal indicating what went wrong. C programs can trap these for diagnostics. Software interrupts: Stop executing the

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

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

Process Concept Process Scheduling Operations On Process Inter-Process Communication Communication in Client-Server Systems

Process Concept Process Scheduling Operations On Process Inter-Process Communication Communication in Client-Server Systems Process Concept Process Scheduling Operations On Process Inter-Process Communication Communication in Client-Server Systems Process Process VS Program Process in Memory Process State Process Control Block

More information

CSCE Operating Systems Interrupts, Exceptions, and Signals. Qiang Zeng, Ph.D. Fall 2018

CSCE Operating Systems Interrupts, Exceptions, and Signals. Qiang Zeng, Ph.D. Fall 2018 CSCE 311 - Operating Systems Interrupts, Exceptions, and Signals Qiang Zeng, Ph.D. Fall 2018 Previous Class Process state transition Ready, blocked, running Call Stack Execution Context Process switch

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

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

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

Processes. Sanzheng Qiao. December, Department of Computing and Software Processes Sanzheng Qiao Department of Computing and Software December, 2012 What is a process? The notion of process is an abstraction. It has been given many definitions. Program in execution is the most

More information

CS 3733 Operating Systems

CS 3733 Operating Systems What will be covered in MidtermI? CS 3733 Operating Systems Instructor: Dr. Tongping Liu Department Computer Science The University of Texas at San Antonio Basics of C programming language Processes, program

More information

Shell Execution of Programs. Process Groups, Session and Signals 1

Shell Execution of Programs. Process Groups, Session and Signals 1 Shell Execution of Programs Process Groups, Session and Signals 1 Signal Concepts Signals are a way for a process to be notified of asynchronous events (software interrupts). Some examples: a timer you

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

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 and Operating Systems Course: International University Bremen Date: Final Examination

Computer Architecture and Operating Systems Course: International University Bremen Date: Final Examination Computer Architecture and Operating Systems Course: 320202 International University Bremen Date: 2006-05-22 Dr. Jürgen Schönwälder Type: open book Final Examination Problem F.1: operating systems (2+2+2+2+2=10

More information

Distributed Systems Operation System Support

Distributed Systems Operation System Support Hajussüsteemid MTAT.08.009 Distributed Systems Operation System Support slides are adopted from: lecture: Operating System(OS) support (years 2016, 2017) book: Distributed Systems: Concepts and Design,

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

CS510 Operating System Foundations. Jonathan Walpole

CS510 Operating System Foundations. Jonathan Walpole CS510 Operating System Foundations Jonathan Walpole The Process Concept 2 The Process Concept Process a program in execution Program - description of how to perform an activity instructions and static

More information

Mon Sep 17, 2007 Lecture 3: Process Management

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

More information

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

Che-Wei Chang Department of Computer Science and Information Engineering, Chang Gung University

Che-Wei Chang Department of Computer Science and Information Engineering, Chang Gung University Che-Wei Chang chewei@mail.cgu.edu.tw Department of Computer Science and Information Engineering, Chang Gung University 1. Introduction 2. System Structures 3. Process Concept 4. Multithreaded Programming

More information

CHAPTER 3 - PROCESS CONCEPT

CHAPTER 3 - PROCESS CONCEPT CHAPTER 3 - PROCESS CONCEPT 1 OBJECTIVES Introduce a process a program in execution basis of all computation Describe features of processes: scheduling, creation, termination, communication Explore interprocess

More information

POSIX Threads Programming

POSIX Threads Programming POSIX Threads Programming 1. Introduction 2. Pthreads Overview 2.1 What is a Thread? 2.2 What are Pthreads? 2.3 Why Pthreads? 2.4 Designing Threaded Programs 3. Compiling Pthreaded Programs 4. Reference

More information

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

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

More information

Chapter 3: Processes

Chapter 3: Processes Chapter 3: Processes Silberschatz, Galvin and Gagne 2013 Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2 Silberschatz, Galvin and Gagne 2013

More information

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

CS 43: Computer Networks. 07: Concurrency and Non-blocking I/O Sep 17, 2018 CS 43: Computer Networks 07: Concurrency and Non-blocking I/O Sep 17, 2018 Reading Quiz Lecture 5 - Slide 2 Today Under-the-hood look at system calls Data buffering and blocking Inter-process communication

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

IT 540 Operating Systems ECE519 Advanced Operating Systems

IT 540 Operating Systems ECE519 Advanced Operating Systems IT 540 Operating Systems ECE519 Advanced Operating Systems Prof. Dr. Hasan Hüseyin BALIK (3 rd Week) (Advanced) Operating Systems 3. Process Description and Control 3. Outline What Is a Process? Process

More information

Computer Architecture

Computer Architecture Instruction Cycle Computer Architecture Program Execution and Instruction Sets INFO 2603 Platform Technologies The basic function performed by a computer is the execution of a program, which is a set of

More information

CS631 - Advanced Programming in the UNIX Environment Interprocess Communication II

CS631 - Advanced Programming in the UNIX Environment Interprocess Communication II CS631 - Advanced Programming in the UNIX Environment Slide 1 CS631 - Advanced Programming in the UNIX Environment Interprocess Communication II Department of Computer Science Stevens Institute of Technology

More information