Systems Programming/ C and UNIX
|
|
- Alison May
- 6 years ago
- Views:
Transcription
1 Systems Programming/ C and UNIX Alice E. Fischer Lecture 6: Processes October 9, 2017 Alice E. FischerLecture 6: Processes Lecture 5: Processes... 1/26 October 9, / 26
2 Outline 1 Processes 2 Process Creation 3 Shell Commands Create Processes 4 A Process Can Create Another Process Alice E. FischerLecture 6: Processes Lecture 5: Processes... 2/26 October 9, / 26
3 Processes Processes What is a Process? Parts of a Unix Process Seeing the Processes Alice E. FischerLecture 6: Processes Lecture 5: Processes... 3/26 October 9, / 26
4 Processes What is a Process? The representation, at run time, of the activity of one user doing one task or one concurrent part of that task. The evolution of the job state through time. Something that is handled by the job scheduling part of the OS. A data structure that contains all the necessary state information for the job to run or to resume running. Alice E. FischerLecture 6: Processes Lecture 5: Processes... 4/26 October 9, / 26
5 Processes Parts of a UNIX Process A process ID (pid): unique among all running processes A parent-process ID (ppid) Security attributes: owner ID, group ID A block of executable code and static literals and variables A stack and a heap (for dynamic allocation) A file table, umask, and working directory The process status (running, blocked, ready, terminated, etc.) Registers (when running) and register-images, (when not running) Status of signals and interrupts An environment (a null-terminated list of pairs of strings) An argument list (a null-terminated list of strings) Optionally, semaphores and locks for inter-process communication. Alice E. FischerLecture 6: Processes Lecture 5: Processes... 5/26 October 9, / 26
6 Processes The Environment Each process has an environment, which is a list of variables with assigned values. Bash syntax from a command shell: PATH="$PATH:." Tcsh syntax from a command shell: set WINDOW_NAME=Lila The variables have upper-case names. Examples: PATH USER LOGNAME HOSTTYPE OSTYPE SHELL To see your environment type: printenv Initially, your environment comes from the /etc/profile file, modified by the login script in your bashrc or cshrc file. Things may be in different places on a Linux system. Read the man page on your shell to see where this file lives. Alice E. FischerLecture 6: Processes Lecture 5: Processes... 6/26 October 9, / 26
7 Processes Viewing the Processes [alice] jodi:~~> ps PID TTY TIME CMD ttys000 0: tcsh ttys001 0: tcsh ps shows you a list of your own processes, attached to your own terminal. You can add several options: The a option shows you everyone s processes. The x option also shows you the daemons also. The w gives a wide listing: it does not truncate the display at the edge of the window. The u gives more usage information Alice E. FischerLecture 6: Processes Lecture 5: Processes... 7/26 October 9, / 26
8 Processes Getting More Process Information [alice] jodi:~~> ps PID TTY TIME CMD ttys000 0: tcsh ttys001 0: tcsh [alice] jodi:~~> ps a PID TT STAT TIME COMMAND s000 Ss 0:00.01 login -pf alice s000 S 0: tcsh s000 R+ 0:00.00 ps a s001 Ss 0:00.01 login -pf alice s001 S+ 0: tcsh Note: these commands give the same information in different formats: [alice] jodi:~~> ps a [alice] jodi:~~> ps -a Alice E. FischerLecture 6: Processes Lecture 5: Processes... 8/26 October 9, / 26
9 Processes Getting More Process Information On my system, ps u gives me 11 columns of information: [alice] jodi:~~> ps u USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND ps ux gives me the same information about more processes And ps uxw gives me the entire command that caused the process to be created, not just the beginning of that command. Alice E. FischerLecture 6: Processes Lecture 5: Processes... 9/26 October 9, / 26
10 Process Creation Process Creation Initial Process Creation User Process Creation Process Creation Demo Alice E. FischerLecture 6: Processes Lecture 5: Processes... 10/26 October 9, / 26
11 Process Creation Initial Process Creation The first process, systemd, is created when you boot the computer. Subsequent processes are created by executing a fork instruction in an existing process. During boot-up, systemd creates many processes, called daemons, that run in the background and are not attached to a command shell. Examples of daemons: mail, ssh, your web server, your desktop,... Your system preferences determine which daemons are started. systemd also creates one user process connected to your shell window (ttys000). It s owner ID, privileges, and environment are taken from the settings in your profile and your.bashrc file. Alice E. FischerLecture 6: Processes Lecture 5: Processes... 11/26 October 9, / 26
12 Process Creation User Process Creation After boot-up, I have one process owned by me and attached to my tty. I can create more processes by: Clicking on an application icon. This creates a GUI window and a daemon process. Logging in remotely. This creates a login shell and a shell process. Creating a new tab in my tcsh window. This calls the login command. Double-clicking on an executable file in my finder listing. This creates a console window with a process running in it. Entering a command into a shell. This forks off another process in the same shell. Executing a fork instruction in my own code. This creates another process connected to the same shell. Alice E. FischerLecture 6: Processes Lecture 5: Processes... 12/26 October 9, / 26
13 Process Creation Process Creation Demo I open a console window by clicking on my console icon and look at my processes: Last login: Mon Apr 30 12:59:42 on ttys001 Terminal? (next33, xterm, vt100, other) [xterm] [alice] jodi:~~> ps ux USER PID TT STAT STARTED TIME COMMAND root s000 Ss 1:07PM 0:00.01 login -pf a alice s000 S 1:07PM 0: tcsh... many daemon processes are omitted here. root s000 R+ 1:07PM 0:00.00 ps ux alice 112?? Ss 4Apr12 1:15.14 /sbin/launc The ps process will die when it is done executing. Alice E. FischerLecture 6: Processes Lecture 5: Processes... 13/26 October 9, / 26
14 Process Creation Opening a Shell Creates two Processes Now use the command-t keystroke to open a new tab on my console window. I have two new processes: one owned by root, the other by me. USER PID TT STAT STARTED TIME COMMAND root s000 Ss 1:07PM 0:00.01 login -pf alic alice s000 S 1:07PM 0: tcsh root s001 Ss 1:14PM 0:00.01 login -pf alice alice s001 S+ 1:14PM 0: tcsh... many daemon processes are omitted here. root s000 R+ 1:14PM 0:00.00 ps ux alice 112?? Ss 4Apr12 1:15.15 /sbin/launchd Alice E. FischerLecture 6: Processes Lecture 5: Processes... 14/26 October 9, / 26
15 Shell Commands Create Processes Shell Commands Create Processes Built-in Commands Login and Remote Login Secure Remote Login Alice E. FischerLecture 6: Processes Lecture 5: Processes... 15/26 October 9, / 26
16 Shell Commands Create Processes Built-In Commands and Others Some commands are built into the shell when it is programmed. This increases efficiency. Example on a former OS-X version: [alice] jodi: > which cd cd: shell built-in command. Other commands are scripted in separate files: Example: [alice] jodi: > which man /usr/bin/man If a command is not built in, executing it creates a process or several. USER PID TT STAT STARTED TIME COMMAND alice s000 S+ 1:32PM 0:00.01 man ps alice s000 S+ 1:32PM 0:00.00 sh -c (cd /usr/share alice s000 S+ 1:32PM 0:00.00 sh -c (cd /usr/share alice s000 S+ 1:32PM 0:00.00 sh -c (cd /usr/share alice s000 S+ 1:32PM 0:00.01 /usr/bin/less -is Alice E. FischerLecture 6: Processes Lecture 5: Processes... 16/26 October 9, / 26
17 Shell Commands Create Processes Sidenote: searching a man page. On Linux, the man command starts up the less command to display the information. USER PID TT STAT STARTED TIME COMMAND alice s000 S+ 1:32PM 0:00.01 man ps alice s000 S+ 1:32PM 0:00.01 /usr/bin/less -is At the end of each page, the display stops and you see a : (colon). Press the space bar to see the next page. less lets you search the man page, including parts that are not currently on the screen, for a keyword. At the colon, type a a slash followed by the word you want to find (no space after /). Example: To search for the word stat, type /stat My system is not case sensitive. My husband s Linux system is. Alice E. FischerLecture 6: Processes Lecture 5: Processes... 17/26 October 9, / 26
18 Shell Commands Create Processes Logging in login: Supplying a valid user name and password gives access to your files and to the use of the system. rlogin: Remote login: antiquated and not to be used. slogin: Secure remote login: passwords are encrypted before transmission. Recently compromised. ssh: New version of secure remote login: passwords are encrypted before transmission. Example: ssh alice@eliza.newhaven.edu The response will be to ask for your password on the remote machine. If you have the same username on both ends, you can use a shorter login command: ssh eliza.newhaven.edu Alice E. FischerLecture 6: Processes Lecture 5: Processes... 18/26 October 9, / 26
19 Shell Commands Create Processes Servers and Clients All Unix systems are servers. Each can participate in a connection as either the client or the server. Each has (or can have) an ssh daemon that is always running and waiting for contact on a standard welcome port. That port is defined in the file /etc/services and is usually port 22. It is possible to change the port to some other port. We have done this on our home gateway server to avoid harassment by hackers. Alice E. FischerLecture 6: Processes Lecture 5: Processes... 19/26 October 9, / 26
20 Shell Commands Create Processes Secure Remote Login - 1 Suppose I am sitting at Lila and want to log into Eliza. On Lila: ssh eliza.newhaven.edu contacts the welcome port on Eliza to request a connection. Suppose you changed the welcome port to The login command would be: ssh -p 4422 eliza.newhaven.edu Eliza s daemon creates a process to handle the new connection (owner _sshd on a Mac, root on Linux). This process frees the daemon to watch for more connections on the welcome port. This process on Eliza talks to Lila s shell process using strong encryption to negotiate a symmetric session key, which is used to encrypt all further communication. Alice E. FischerLecture 6: Processes Lecture 5: Processes... 20/26 October 9, / 26
21 Shell Commands Create Processes Secure Remote Login - 2 Now the root process can complete the login process safely: Eliza requests your password or passphrase, which will be encrypted by Lila, then sent. Eliza decrypts the password and validates it. If valid, Eliza will open a shell process for you (owned by you). The stdin and stdout for this shell process are attached to pipes that deliver all communication through the encrypted channel to Lila. You sit at Lila and use the remote shell process. All activity is visible on Lila (but not on Eliza). Shell commands control the remote machine. When you log out of Eliza, your remote shell and your ssh shell die, and control reverts to your local shell. Alice E. FischerLecture 6: Processes Lecture 5: Processes... 21/26 October 9, / 26
22 Shell Commands Create Processes The Newborn Process A new process gets its own: Process ID and PPID. A stack, that is a copy of the parent s stack, but with a different return value. for the fork function that created the new process. A new process inherits copies of these things from its parent: User and group IDs and a set of permissions. Command-line arguments, an environment, variables. The file table and the list of open files. A program counter that points to the next instruction to be run. This is the same for parent and child. Alice E. FischerLecture 6: Processes Lecture 5: Processes... 22/26 October 9, / 26
23 A Process Can Create Another Process A Process Can Create Another Process Booting creates the first process. All other processes are created by forking. fork results in a parent process and a child. exec tells a process what code to execute. Alice E. FischerLecture 6: Processes Lecture 5: Processes... 23/26 October 9, / 26
24 A Process Can Create Another Process A New User Process Processes are created by pid_t fork( void ); (from unistd.h) The new process will be the daughter of the original process. Its ppid will be the pid of the parent process or thread. The daughter s owner, code, and data will be almost identical copies of the parent s. The parent process or thread will receive the daughter process s pid as the return value from fork(). (Or -1 if there was a system error such as too many processes.) The daughter process will receive a return value of 0. The differing return values must be used by parent and child to figure out which is which. Usually, the parent forks more processes and waits for all to complete. Usually, a daughter will immediately call command. execve(), or another exec Alice E. FischerLecture 6: Processes Lecture 5: Processes... 24/26 October 9, / 26
25 A Process Can Create Another Process Demo: sayit The sayit demo executes the very simplest kind of fork. Everything is in the main function. There is one variable, k, in main. Each process ends up with an independent copy of k: the child process is given new virtual memory as soon as it tries to store into k. On line 10, the process forks. The parent process or thread will receive the daughter process s pid as the return value from fork(). The daughter process will receive a return value of 0. The differing return values must be used by parent (line 13) and child (line 27) to figure out which is which. Both of them display messages to the screen. This lets us observe the way processes are scheduled on the host system. Executing ps au or top -o cpu in a second shell lets us monitor resource consumption. wait() suspends its calling process until its child terminates. Alice E. FischerLecture 6: Processes Lecture 5: Processes... 25/26 October 9, / 26
26 A Process Can Create Another Process Do This Mini-lab Yourself Create a demo directory. Put the 2 tools files and a copy of sayit.c in it. Compile sayit.c, with the tools, to produce an executable sayit1. Now edit sayit.c to remove k<200 from both loops. Compile sayit.c again to produce a sayit2 that will run forever. Open two console windows (or one with two tabs.) In the first, type the command ps au and be ready to hit enter. In the second console, type./sayit1 and hit enter. Then hit enter in console-1. Do this several times. Observe the number of processes running and how the output from the two sayit1 processes is interleaved on the screen. Repeat with sayit2. This time, execute the ps command repeatedly, noting how the execution time increases. Close console-2 to stop these runaway processes! Otherwise you may need to reboot. Alice E. FischerLecture 6: Processes Lecture 5: Processes... 26/26 October 9, / 26
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 informationHigh 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 informationLinux System Administration
System Processes Objective At the conclusion of this module, the student will be able to: Describe and define a process Identify a process ID, the parent process and the child process Learn the PID for
More informationIntroduction to OS Processes in Unix, Linux, and Windows MOS 2.1 Mahmoud El-Gayyar
Introduction to OS Processes in Unix, Linux, and Windows MOS 2.1 Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg Mahmoud El-Gayyar / Introduction to OS 1 Processes in Unix, Linux, and Windows Unix pre-empted
More informationOperating System Structure
Operating System Structure CSCI 4061 Introduction to Operating Systems Applications Instructor: Abhishek Chandra Operating System Hardware 2 Questions Operating System Structure How does the OS manage
More informationPROCESSES. Jo, Heeseung
PROCESSES Jo, Heeseung TODAY'S TOPICS What is the process? How to implement processes? Inter-Process Communication (IPC) 2 WHAT IS THE PROCESS? Program? vs. Process? vs. Processor? 3 PROCESS CONCEPT (1)
More informationProcesses. Jo, Heeseung
Processes Jo, Heeseung Today's Topics What is the process? How to implement processes? Inter-Process Communication (IPC) 2 What Is The Process? Program? vs. Process? vs. Processor? 3 Process Concept (1)
More informationSystems Programming/ C and UNIX
Systems Programming/ C and UNIX Alice E. Fischer September 6, 2017 Alice E. Fischer Systems Programming Lecture 2... 1/28 September 6, 2017 1 / 28 Outline 1 Booting into Linux 2 The Command Shell 3 Defining
More informationSimplest version of DayOfYear
Reminder from last week: Simplest version of DayOfYear class DayOfYear { public: void output(); int month; int day; }; Like a struct with an added method All parts public Clients access month, day directly
More informationOperating Systems. Lecture 05
Operating Systems Lecture 05 http://web.uettaxila.edu.pk/cms/sp2013/seosbs/ February 25, 2013 Process Scheduling, System Calls Execution (Fork,Wait,Exit,Exec), Inter- Process Communication Schedulers Long
More informationProcesses. CS3026 Operating Systems Lecture 05
Processes CS3026 Operating Systems Lecture 05 Dispatcher Admit Ready Queue Dispatch Processor Release Timeout or Yield Event Occurs Blocked Queue Event Wait Implementation: Using one Ready and one Blocked
More informationENGR 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 informationOperating Systems. II. Processes
Operating Systems II. Processes Ludovic Apvrille ludovic.apvrille@telecom-paristech.fr Eurecom, office 470 http://soc.eurecom.fr/os/ @OS Eurecom Outline Concepts Definitions and basic concepts Process
More information3. Process Management in xv6
Lecture Notes for CS347: Operating Systems Mythili Vutukuru, Department of Computer Science and Engineering, IIT Bombay 3. Process Management in xv6 We begin understanding xv6 process management by looking
More informationCPSC 457 OPERATING SYSTEMS MIDTERM EXAM SOLUTION
CPSC 457 OPERATING SYSTEMS MIDTERM EXAM SOLUTION Department of Computer Science University of Calgary Professor: Carey Williamson October 29, 2008 This is a CLOSED BOOK exam. Textbooks, notes, laptops,
More informationReview of Fundamentals
Review of Fundamentals 1 The shell vi General shell review 2 http://teaching.idallen.com/cst8207/14f/notes/120_shell_basics.html The shell is a program that is executed for us automatically when we log
More informationImplementation of a simple shell, xssh
Implementation of a simple shell, xssh What is a shell? A process that does command line interpretation Reads a command from standard input (stdin) Executes command corresponding to input line In simple
More informationPROCESS 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 informationOperating Systems. Copyleft 2005, Binnur Kurt
3 Operating Systems Copyleft 2005, Binnur Kurt Content The concept of an operating system. The internal architecture of an operating system. The architecture of the Linux operating system in more detail.
More informationGetting Started. Logging In and Out. Adapted from Practical Unix and Programming Hunter College
Getting Started Logging In and Out Adapted from Practical Unix and Programming Hunter College Copyright 2006 Stewart Weiss Getting started: logging in and out Every user in UNIX has a username (also called
More informationOperating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing
Content 3 Operating Systems The concept of an operating system. The internal architecture of an operating system. The architecture of the Linux operating system in more detail. How to log into (and out
More informationAnnouncements 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 informationCreating a Shell or Command Interperter Program CSCI411 Lab
Creating a Shell or Command Interperter Program CSCI411 Lab Adapted from Linux Kernel Projects by Gary Nutt and Operating Systems by Tannenbaum Exercise Goal: You will learn how to write a LINUX shell
More information5/20/2007. Touring Essential Programs
Touring Essential Programs Employing fundamental utilities. Managing input and output. Using special characters in the command-line. Managing user environment. Surveying elements of a functioning system.
More informationCOMP 3430 Robert Guderian
Operating Systems COMP 3430 Robert Guderian file:///users/robg/dropbox/teaching/3430-2018/slides/03_processes/index.html?print-pdf#/ 1/53 1 Processes file:///users/robg/dropbox/teaching/3430-2018/slides/03_processes/index.html?print-pdf#/
More informationShells and Processes. Bryce Boe 2012/08/08 CS32, Summer 2012 B
Shells and Processes Bryce Boe 2012/08/08 CS32, Summer 2012 B Outline Opera>ng Systems and Linux Review Shells Project 1 Part 1 Overview Processes Overview for Monday (Sor>ng Presenta>ons) OS Review Opera>ng
More informationUnix Tutorial Haverford Astronomy 2014/2015
Unix Tutorial Haverford Astronomy 2014/2015 Overview of Haverford astronomy computing resources This tutorial is intended for use on computers running the Linux operating system, including those in the
More informationFall 2015 COMP Operating Systems. Lab #3
Fall 2015 COMP 3511 Operating Systems Lab #3 Outline n Operating System Debugging, Generation and System Boot n Review Questions n Process Control n UNIX fork() and Examples on fork() n exec family: execute
More informationLinux Command Line Interface. December 27, 2017
Linux Command Line Interface December 27, 2017 Foreword It is supposed to be a refresher (?!) If you are familiar with UNIX/Linux/MacOS X CLI, this is going to be boring... I will not talk about editors
More informationCS 300 Data Structures
CS 300 Data Structures Introduction 1 Topics Data Structures Linux C Programming Software Development Tools Software Development Methods 2 UNIX/Linux/GNU UNIX is an Operating System (OS) 1969 at Bell Labs
More informationUnix Basics. Systems Programming Concepts
Concepts Unix directories Important Unix file commands man, pwd, ls, mkdir, cd, cp, mv File and directory access rights through permission settings Using chmod to change permissions Other important Unix
More informationMon 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 informationReview of Fundamentals. Todd Kelley CST8207 Todd Kelley 1
Review of Fundamentals Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 GPL the shell SSH (secure shell) the Course Linux Server RTFM vi general shell review 2 These notes are available on
More informationProcesses 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 informationReview of Fundamentals. Todd Kelley CST8207 Todd Kelley 1
Review of Fundamentals Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 The CST8207 course notes GPL the shell SSH (secure shell) the Course Linux Server RTFM vi general shell review 2 Linux
More information1/13/2019 Operating Systems. file:///volumes/users/rasit/desktop/comp3430/coursematerial/slides/03_processes/index.html?
Operating Systems COMP 3430 Eskicioglu & Guderian file:///volumes/users/rasit/desktop/comp3430/coursematerial/slides/03_processes/index.html?print-pdf#/ 1/52 1 Processes file:///volumes/users/rasit/desktop/comp3430/coursematerial/slides/03_processes/index.html?print-pdf#/
More informationProcesses in linux. What s s a process? process? A dynamically executing instance of a program. David Morgan. David Morgan
Processes in linux David Morgan What s s a process? process? A dynamically executing instance of a program 1 Constituents of a process its code data various attributes OS needs to manage it OS keeps track
More informationLab 1: Accessing the Linux Operating System Spring 2009
CIS 90 Linux Lab Exercise Lab 1: Accessing the Linux Operating System Spring 2009 Lab 1: Accessing the Linux Operating System This lab takes a look at UNIX through an online experience on an Ubuntu Linux
More informationCS61 Scribe Notes Lecture 18 11/6/14 Fork, Advanced Virtual Memory
CS61 Scribe Notes Lecture 18 11/6/14 Fork, Advanced Virtual Memory Roger, Ali, and Tochi Topics: exploits fork shell programming rest of course announcements/ending (for later info) final (not as time
More informationECE 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 informationCPSC 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 informationIntroduction: What is Unix?
Introduction Introduction: What is Unix? An operating system Developed at AT&T Bell Labs in the 1960 s Command Line Interpreter GUIs (Window systems) are now available Introduction: Unix vs. Linux Unix
More informationProcess 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 information518 Lecture Notes Week 3
518 Lecture Notes Week 3 (Sept. 15, 2014) 1/8 518 Lecture Notes Week 3 1 Topics Process management Process creation with fork() Overlaying an existing process with exec Notes on Lab 3 2 Process management
More informationCSC209H Lecture 1. Dan Zingaro. January 7, 2015
CSC209H Lecture 1 Dan Zingaro January 7, 2015 Welcome! Welcome to CSC209 Comments or questions during class? Let me know! Topics: shell and Unix, pipes and filters, C programming, processes, system calls,
More informationCSE 451: Operating Systems Winter Module 4 Processes. Mark Zbikowski Allen Center 476
CSE 451: Operating Systems Winter 2015 Module 4 Processes Mark Zbikowski mzbik@cs.washington.edu Allen Center 476 2013 Gribble, Lazowska, Levy, Zahorjan Process management This module begins a series of
More informationRemoving files and directories, finding files and directories, controlling programs
Removing files and directories, finding files and directories, controlling programs Laboratory of Genomics & Bioinformatics in Parasitology Department of Parasitology, ICB, USP Removing files Files can
More informationProcess management. What s in a process? What is a process? The OS s process namespace. A process s address space (idealized)
Process management CSE 451: Operating Systems Spring 2012 Module 4 Processes Ed Lazowska lazowska@cs.washington.edu Allen Center 570 This module begins a series of topics on processes, threads, and synchronization
More informationCPSC 457 OPERATING SYSTEMS MIDTERM EXAM
CPSC 457 OPERATING SYSTEMS MIDTERM EXAM Department of Computer Science University of Calgary Professor: Carey Williamson March 9, 2010 This is a CLOSED BOOK exam. Textbooks, notes, laptops, calculators,
More informationIntroduction to Linux
Introduction to Linux Mukesh Pund Principal Scientist, NISCAIR, New Delhi, India History In 1969, a team of developers developed a new operating system called Unix which was written using C Linus Torvalds,
More informationProcesses. What s s a process? process? A dynamically executing instance of a program. David Morgan
Processes David Morgan What s s a process? process? A dynamically executing instance of a program 1 Constituents of a process its code data various attributes OS needs to manage it OS keeps track of all
More informationMost of the work is done in the context of the process rather than handled separately by the kernel
Process Control Process Abstraction for a running program Manages program s use of memory, cpu time, and i/o resources Most of the work is done in the context of the process rather than handled separately
More informationProcesses. 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 informationChap 4, 5: Process. Dongkun Shin, SKKU
Chap 4, 5: Process 1 Process Concept Job A bundle of program and data to be executed An entity before submission for execution Process (= running program) An entity that is registered to kernel for execution
More informationOS lpr. www. nfsd gcc emacs ls 1/27/09. Process Management. CS 537 Lecture 3: Processes. Example OS in operation. Why Processes? Simplicity + Speed
Process Management CS 537 Lecture 3: Processes Michael Swift This lecture begins a series of topics on processes, threads, and synchronization Today: processes and process management what are the OS units
More informationCSC 1600 Unix Processes. Goals of This Lecture
CSC 1600 Unix Processes q Processes Goals of This Lecture q Process vs. program q Context switching q Creating a new process q fork: process creates a new child process q wait: parent waits for child process
More informationThe Unix Shell & Shell Scripts
The Unix Shell & Shell Scripts You should do steps 1 to 7 before going to the lab. Use the Linux system you installed in the previous lab. In the lab do step 8, the TA may give you additional exercises
More informationProcesses. 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 informationLecture Topics. Announcements. Today: Threads (Stallings, chapter , 4.6) Next: Concurrency (Stallings, chapter , 5.
Lecture Topics Today: Threads (Stallings, chapter 4.1-4.3, 4.6) Next: Concurrency (Stallings, chapter 5.1-5.4, 5.7) 1 Announcements Make tutorial Self-Study Exercise #4 Project #2 (due 9/20) Project #3
More informationProcess 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 informationEssential Unix and Linux! Perl for Bioinformatics, ! F. Pineda
Essential Unix and Linux! Perl for Bioinformatics, 140.636! F. Pineda Generic computer architecture Memory Storage Fig. 1.2 From Designing Embedded Hardware, 2 nd Ed. by John Catsoulis OS concepts Shell
More informationCSE 410: Computer Systems Spring Processes. John Zahorjan Allen Center 534
CSE 410: Computer Systems Spring 2018 Processes John Zahorjan zahorjan@cs.washington.edu Allen Center 534 1. What is a process? Processes 2. What's the process namespace? 3. How are processes represented
More informationCS Fundamentals of Programming II Fall Very Basic UNIX
CS 215 - Fundamentals of Programming II Fall 2012 - Very Basic UNIX This handout very briefly describes how to use Unix and how to use the Linux server and client machines in the CS (Project) Lab (KC-265)
More informationIntroduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines
Introduction to UNIX Logging in Basic system architecture Getting help Intro to shell (tcsh) Basic UNIX File Maintenance Intro to emacs I/O Redirection Shell scripts Logging in most systems have graphical
More informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2016 Lecture 5 Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 User Operating System Interface - CLI CLI
More informationProcesses. slide 1 kv, gm. Silberschatz chapter 3
Processes slide 1 Silberschatz chapter 3 Process concepts slide 2 definition of a process (sometimes called a Task) aprogram in execution an executable file + some kind of dynamic data managed by the OS
More informationIBM AIX Operating System Courses
IBM AIX Operating System Courses (Platforms: POWER4+ based) AIX Basics Fundamentals (3 days) AIX Basics Shell Scripting (Korn / Bash ) and awk Programming (3 days) Advanced IBM AIX Systems Programming
More informationProcess concepts. Processes. Process in Memory. Process Creation. definition of a process (sometimes called a Task) aprogram in execution
Processes slide 1 Process concepts slide 2 Silberschatz chapter 3 definition of a process (sometimes called a Task) aprogram in execution an executable file + some kind of dynamic data managed by the OS
More informationOperating System Interaction via bash
Operating System Interaction via bash bash, or the Bourne-Again Shell, is a popular operating system shell that is used by many platforms bash uses the command line interaction style generally accepted
More informationCS 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 informationComputer Science 322 Operating Systems Mount Holyoke College Spring Topic Notes: Processes and Threads
Computer Science 322 Operating Systems Mount Holyoke College Spring 2010 Topic Notes: Processes and Threads What is a process? Our text defines it as a program in execution (a good definition). Definitions
More informationThe Process Abstraction. CMPU 334 Operating Systems Jason Waterman
The Process Abstraction CMPU 334 Operating Systems Jason Waterman How to Provide the Illusion of Many CPUs? Goal: run N processes at once even though there are M CPUs N >> M CPU virtualizing The OS can
More informationStudy Guide Processes & Job Control
Study Guide Processes & Job Control Q1 - PID What does PID stand for? Q2 - Shell PID What shell command would I issue to display the PID of the shell I'm using? Q3 - Process vs. executable file Explain,
More informationCSci 4061 Introduction to Operating Systems. Processes in C/Unix
CSci 4061 Introduction to Operating Systems Processes in C/Unix Process as Abstraction Talked about C programs a bit Program is a static entity Process is an abstraction of a running program provided by
More informationCS 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 informationSOFTWARE ARCHITECTURE 3. SHELL
1 SOFTWARE ARCHITECTURE 3. SHELL Tatsuya Hagino hagino@sfc.keio.ac.jp slides URL https://vu5.sfc.keio.ac.jp/sa/login.php 2 Software Layer Application Shell Library MIddleware Shell Operating System Hardware
More informationPROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo
PROCESS MANAGEMENT Operating Systems 2015 Spring by Euiseong Seo Today s Topics Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication
More informationBinghamton University. CS-220 Spring Sharing Resources. Computer Systems Chapter 8.2, 8.4
Sharing Resources Computer Systems Chapter 8.2, 8.4 Abstract View When I run my program, it has access to the entire computer, including the processor, memory, keyboard, display, disk drives, network connections,
More informationCrash Course in Unix. For more info check out the Unix man pages -orhttp://www.cs.rpi.edu/~hollingd/unix. -or- Unix in a Nutshell (an O Reilly book).
Crash Course in Unix For more info check out the Unix man pages -orhttp://www.cs.rpi.edu/~hollingd/unix -or- Unix in a Nutshell (an O Reilly book). 1 Unix Accounts To access a Unix system you need to have
More informationwww nfsd emacs lpr Process Management CS 537 Lecture 4: Processes Example OS in operation Why Processes? Simplicity + Speed
Process Management CS 537 Lecture 4: Processes Michael Swift This lecture begins a series of topics on processes, threads, and synchronization Today: processes and process management what are the OS units
More informationCS 475. Process = Address space + one thread of control Concurrent program = multiple threads of control
Processes & Threads Concurrent Programs Process = Address space + one thread of control Concurrent program = multiple threads of control Multiple single-threaded processes Multi-threaded process 2 1 Concurrent
More informationOperating systems and concurrency - B03
Operating systems and concurrency - B03 David Kendall Northumbria University David Kendall (Northumbria University) Operating systems and concurrency - B03 1 / 15 Introduction This lecture gives a more
More informationWeek 5 Lesson 5 02/28/18
Week 5 Lesson 5 02/28/18 Important Announcements Extra Credits If you haven t done so, send your pictures to risimms@cabrillo.edu for 3 points EXTRA CREDIT. Join LinkedIn for 3 points Perkins/VTEA Survey
More informationLecture 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 informationIntroduction to Process in Computing Systems SEEM
Introduction to Process in Computing Systems SEEM 3460 1 Programs and Processes One way to describe the hardware of a computer system is to say that it provides a framework for executing programs and storing
More informationUNIX Kernel. UNIX History
UNIX History UNIX Kernel 1965-1969 Bell Labs participates in the Multics project. 1969 Ken Thomson develops the first UNIX version in assembly for an DEC PDP-7 1973 Dennis Ritchie helps to rewrite UNIX
More informationProcess Management forks, bombs, zombies, and daemons! Lecture 5, Hands-On Unix System Administration DeCal
Process Management forks, bombs, zombies, and daemons! Lecture 5, Hands-On Unix System Administration DeCal 2012-10-01 what is a process? an abstraction! you can think of it as a program in the midst of
More informationCOSC243 Part 2: Operating Systems
COSC243 Part 2: Operating Systems Lecture 16: Threads and data sharing Zhiyi Huang Dept. of Computer Science, University of Otago Zhiyi Huang (Otago) COSC243 Lecture 16 1 / 24 Overview Last lecture: Hierarchical
More informationPerl and R Scripting for Biologists
Perl and R Scripting for Biologists Lukas Mueller PLBR 4092 Course overview Linux basics (today) Linux advanced (Aure, next week) Why Linux? Free open source operating system based on UNIX specifications
More informationWhat is the Shell. Whenever you login to a Unix system you are placed in a program called the shell. All of your work is done within the shell.
What is the Shell Whenever you login to a Unix system you are placed in a program called the shell. All of your work is done within the shell. The shell is your interface to the operating system. It acts
More informationCSE506: Operating Systems CSE 506: Operating Systems
CSE 506: Operating Systems What Software Expects of the OS What Software Expects of the OS Shell Memory Address Space for Process System Calls System Services Launching Program Executables Shell Gives
More informationDesign 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 informationOperating System Labs. Yuanbin Wu
Operating System Labs Yuanbin Wu cs@ecnu Anouncement Project 1 due 21:00 Oct. 4th FTP In campus: direct connection Out of campus: VPN Windows: cmd \\222.204.249.4:5010 Linux: ftp 222.204.249.4 5010 Operating
More informationDesign 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 informationUniversidad Carlos III de Madrid Computer Science and Engineering Department Operating Systems Course
Exercise 1 (20 points). Autotest. Answer the quiz questions in the following table. Write the correct answer with its corresponding letter. For each 3 wrong answer, one correct answer will be subtracted
More informationProcesses & Threads. Today. Next Time. ! Process concept! Process model! Implementing processes! Multiprocessing once again. ! More of the same J
Processes & Threads Today! Process concept! Process model! Implementing processes! Multiprocessing once again Next Time! More of the same J The process model! Most computers can do more than one thing
More informationCS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX
CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX This handout very briefly describes how to use Unix and how to use the Linux server and client machines in the EECS labs that dual boot
More informationProcesses. CS439: Principles of Computer Systems January 24, 2018
Processes CS439: Principles of Computer Systems January 24, 2018 Last Time History Lesson Hardware expensive, humans cheap Hardware cheap, humans expensive Hardware very cheap, humans very expensive Dual-mode
More informationMidterm Exam CPS 210: Operating Systems Spring 2013
Your name: Sign for your honor: Midterm Exam CPS 210: Operating Systems Spring 2013 The last page of this exam is a list of terms used in this class, and whose meanings you should know. You may detach
More informationThe Shell, System Calls, Processes, and Basic Inter-Process Communication
The Shell, System Calls, Processes, and Basic Inter-Process Communication Michael Jantz Dr. Prasad Kulkarni 1 Shell Programs A shell program provides an interface to the services of the operating system.
More information