UNIX Structure. Operating Systems In Depth VII 1 Copyright 2018 Thomas W. Doeppner. All rights reserved.
|
|
- Martha George
- 6 years ago
- Views:
Transcription
1 UNIX Structure Operating Systems In Depth VII 1 Copyright 2018 Thomas W. Doeppner. All rights reserved.
2 The Unix Address Space stack dynamic bss data text Operating Systems In Depth VII 2 Copyright 2018 Thomas W. Doeppner. All rights reserved.
3 Creating a Process: Before fork( ) parent process Operating Systems In Depth VII 3 Copyright 2018 Thomas W. Doeppner. All rights reserved.
4 Creating a Process: After fork( ) // returns p parent process fork( ) // returns 0 child process (pid = p) Operating Systems In Depth VII 4 Copyright 2018 Thomas W. Doeppner. All rights reserved.
5 Fork and Wait short pid; if ((pid = fork()) == 0) { /* some code is here for the child to execute */ exit(n); } else { int ReturnCode; while(pid!= wait(&returncode)) ; /* the child has terminated with ReturnCode as its return code */ } Operating Systems In Depth VII 5 Copyright 2018 Thomas W. Doeppner. All rights reserved.
6 PID Process Control Blocks Terminated children Link Return code Other Stuff Process Control Block PID Terminated children Link Return code Other Stuff PID Terminated children Link Return code Other Stuff Operating Systems In Depth VII 6 Copyright 2018 Thomas W. Doeppner. All rights reserved.
7 Exec int pid; if ((pid = fork()) == 0) { } /* we ll soon discuss what might take place before exec is called */ execl("/home/twd/bin/primes", "primes", "300", 0); exit(1); /* parent continues here */ while(pid!= wait(0)) /* ignore the return code */ ; Operating Systems In Depth VII 7 Copyright 2018 Thomas W. Doeppner. All rights reserved.
8 Loading a New Image args exec(prog, args) Before prog s bss prog s data prog s text After Operating Systems In Depth VII 8 Copyright 2018 Thomas W. Doeppner. All rights reserved.
9 int A, B, C, D; A=1; if (fork() > 0) { B=1; A=111; } else { C=2; } if (fork() > 0) { D=222; } else { } D=A+B+C; // what value is now // in D for this process? exit(0); Quiz 1 Answer: a) 0 b) 3 c) 113 d) indeterminate Operating Systems In Depth VII 9 Copyright 2018 Thomas W. Doeppner. All rights reserved.
10 Representing the Address Space Important component of a process is its address space how is it represented? Can page tables represent a process s address space? Operating Systems In Depth VII 10 Copyright 2018 Thomas W. Doeppner. All rights reserved.
11 Simple User Address Space stack bss & dynamic data text Operating Systems In Depth VII 11 Copyright 2018 Thomas W. Doeppner. All rights reserved.
12 Address-Space Representation Somewhat Simplified task_struct mm_struct vm_area_struct 0 7fff x, shared vm_area_struct afff rw, private vm_area_struct 1b000 1bfff rw, private vm_area_struct 7fffd000 7fffffff rw, private struct file Operating Systems In Depth VII 12 Copyright 2018 Thomas W. Doeppner. All rights reserved.
13 Adding a Mapped File stack mapped file bss & dynamic data text Operating Systems In Depth VII 13 Copyright 2018 Thomas W. Doeppner. All rights reserved.
14 Address-Space Representation: More Areas task_struct mm_struct vm_area_struct 0 7fff x, shared vm_area_struct afff rw, private vm_area_struct 1b000 1bfff rw, private vm_area_struct fff rw, shared vm_area_struct 7fffd000 7fffffff rw, private struct file struct file Operating Systems In Depth VII 14 Copyright 2018 Thomas W. Doeppner. All rights reserved.
15 Adding More Stuff stack 1 stack 2 stack 3 mapped file 1 mapped file 2 mapped file 3. mapped file 117 bss & dynamic data text Operating Systems In Depth VII 15 Copyright 2018 Thomas W. Doeppner. All rights reserved.
16 Address-Space Representation: Reality task_struct mm_struct fff 1b000 1bfff fff 0 7fff afff fff 7fffd000 7fffffff fff Operating Systems In Depth VII 16 Copyright 2018 Thomas W. Doeppner. All rights reserved.
17 Layering User Applications System Calls User Kernel Virtual File System (VFS) disk file systems (e.g. S5FS) terminals networking other things (e.g. /proc) Operating Systems In Depth VII 17 Copyright 2018 Thomas W. Doeppner. All rights reserved.
18 Quiz 2 int fd1 = open("file", O_CREAT O_RDWR, 0666); unlink("file"); write(fd1, "123", 3); int fd2 = open("file", O_CREAT O_RDWR, 0666); write(fd2, "4", 1); if (fork() == 0) { write(fd1, "5", 1); } exit(0); The final contents of file are: a) b) 453 c) 45 d) 4 Operating Systems In Depth VII 18 Copyright 2018 Thomas W. Doeppner. All rights reserved.
19 File-Descriptor Table File-descriptor table File descriptor ref count access mode file location inode pointer. User address space n 1 Kernel address space Operating Systems In Depth VII 19 Copyright 2018 Thomas W. Doeppner. All rights reserved.
20 Allocation of File Descriptors Whenever a process requests a new file descriptor, the lowest numbered file descriptor not already associated with an open file is selected; thus #include <fcntl.h> #include <unistd.h> close(0); fd = open("file", O_RDONLY); will always associate file with file descriptor 0 (assuming that the open succeeds) Operating Systems In Depth VII 20 Copyright 2018 Thomas W. Doeppner. All rights reserved.
21 Redirecting Output Twice if (fork() == 0) { /* set up file descriptors 1 and 2 in the child process */ } close(1); close(2); if (open("/home/twd/output", O_WRONLY) == -1) { } exit(1); if (open("/home/twd/output", O_WRONLY) == -1) { exit(1); } execl("/home/twd/bin/program", "program", 0); exit(1); /* parent continues here */ Operating Systems In Depth VII 21 Copyright 2018 Thomas W. Doeppner. All rights reserved.
22 Redirected Output File descriptor 1 File-descriptor table 1 WRONLY 0 inode pointer File descriptor 2 1 WRONLY 0 inode pointer User address space Kernel address space Operating Systems In Depth VII 22 Copyright 2018 Thomas W. Doeppner. All rights reserved.
23 Redirected Output After Write File descriptor 1 File-descriptor table 1 WRONLY 100 inode pointer File descriptor 2 1 WRONLY 0 inode pointer User address space Kernel address space Operating Systems In Depth VII 23 Copyright 2018 Thomas W. Doeppner. All rights reserved.
24 Sharing Context Information if (fork() == 0) { /* set up file descriptors 1 and 2 in the child process */ close(1); close(2); if (open("/home/twd/output", O_WRONLY) == -1) { } exit(1); dup(1); /* set up file descriptor 2 as a duplicate of 1 */ execl("/home/twd/bin/program", "program", 0); exit(1); } /* parent continues here */ Operating Systems In Depth VII 24 Copyright 2018 Thomas W. Doeppner. All rights reserved.
25 Redirected Output After Dup File descriptor 1 File descriptor 2 File-descriptor table 2 WRONLY 100 inode pointer User address space Kernel address space Operating Systems In Depth VII 25 Copyright 2018 Thomas W. Doeppner. All rights reserved.
26 Fork and File Descriptors int logfile = open("log", O_WRONLY); if (fork() == 0) { } /* child process computes something, then does: */ write(logfile, LogEntry, strlen(logentry)); exit(0); /* parent process computes something, then does: */ write(logfile, LogEntry, strlen(logentry)); Operating Systems In Depth VII 26 Copyright 2018 Thomas W. Doeppner. All rights reserved.
27 File Descriptors After Fork logfile Parent s address space 2 WRONLY 0 inode pointer logfile Child s address space Kernel address space Operating Systems In Depth VII 27 Copyright 2018 Thomas W. Doeppner. All rights reserved.
28 Directories unix etc home pro dev passwd motd twd unix... slide1 slide2 Operating Systems In Depth VII 28 Copyright 2018 Thomas W. Doeppner. All rights reserved.
29 Directory Representation Component Name directory entry Inode Number unix 117 etc 4 home 18 pro 36 dev 93 Operating Systems In Depth VII 29 Copyright 2018 Thomas W. Doeppner. All rights reserved.
30 Hard Links unix etc home pro dev twd image motd unix... slide1 slide2 % ln /unix /etc/image # link system call Operating Systems In Depth VII 30 Copyright 2018 Thomas W. Doeppner. All rights reserved.
31 Directory Representation unix 117 etc 4 home 18 pro 36 dev image 117 motd 33 Operating Systems In Depth VII 31 Copyright 2018 Thomas W. Doeppner. All rights reserved.
32 Soft Links unix etc home pro dev twd image twd unix... mylink /home/twd % ln s /unix /home/twd/mylink % ln s /home/twd /etc/twd # symlink system call slide1 slide2 /unix Operating Systems In Depth VII 32 Copyright 2018 Thomas W. Doeppner. All rights reserved.
33 Working Directory Maintained in kernel for each process paths not starting from / start with the working directory changed by use of the chdir system call displayed (via shell) using pwd - how is this done? Operating Systems In Depth VII 33 Copyright 2018 Thomas W. Doeppner. All rights reserved.
34 Mount Points (1) unix etc usr mnt dev tty01 tty02 dsk1 dsk2 tp1 src lib bin Operating Systems In Depth VII 34 Copyright 2018 Thomas W. Doeppner. All rights reserved.
35 Mount Points (2) unix etc usr mnt dev tty01 tty02 dsk1 dsk2 tp1 src lib bin mount /dev/dsk2 /usr Operating Systems In Depth VII 35 Copyright 2018 Thomas W. Doeppner. All rights reserved.
36 Representing File Systems class fs { char dev[str_max]; char mountpt[str_max]; vnode *vnodecovered; vnode *root; virtual void read_vnode(vnode *); virtual void delete_vnode(vnode *); }; // device containing the f.s. // where the f.s. is mounted // file on which f.s. is mounted // root of the f.s. Operating Systems In Depth VII 36 Copyright 2018 Thomas W. Doeppner. All rights reserved.
37 Representing Files class vnode { unsigned short refcount; fs *vfsmounted; fs *vfs; unsigned long vno; int mode; int len; link_list_t link; kmutex_t mutex; virtual int create(const char *, int, vnode **); virtual int read(int, void *, int); virtual int write(int, const void *, int); }; Operating Systems In Depth VII 37 Copyright 2018 Thomas W. Doeppner. All rights reserved.
38 Mounting a File System (1) /dev/disk0 / dev mountpt vnodecovered vfs_root_vn root [/] [/a/b] Operating Systems In Depth VII 38 Copyright 2018 Thomas W. Doeppner. All rights reserved.
39 Mounting a File System (2) /dev/disk0 / /dev/disk1 /a/b vfs_root_vn [/] [/a/b] [/a/b] [/a/b/ ] Operating Systems In Depth VII 39 Copyright 2018 Thomas W. Doeppner. All rights reserved.
40 But Wait What s this about C++? real operating systems are written in C Operating Systems In Depth VII 40 Copyright 2018 Thomas W. Doeppner. All rights reserved.
41 fs class fs { char dev[str_max]; }; char mountpt[str_max]; vnode *vnodecovered; vnode *root; virtual void read_vnode(vnode *); virtual void delete_vnode(vnode *); typedef struct fs { char fs_dev[str_max]; char fs_mountpt[str_max]; struct vnode *fs_vnodecovered; struct vnode *fs_root; fs_ops_t *fs_op; /* function pointers */ void *fs_i; /* extra stuff in subclasses */ } fs_t; Operating Systems In Depth VII 41 Copyright 2018 Thomas W. Doeppner. All rights reserved.
42 vnode class vnode { unsigned short refcount; fs *vfsmounted; fs *vfs; unsigned long vno; int mode; int len; link_list_t link; kmutex_t mutex; virtual int create(const char *, int, vnode **); virtual int read(int, void *, int); virtual int write(int, const void *, int); }; typedef struct vnode { unsigned short vn_refcount; struct fs *vn_vfsmounted; struct fs *vn_vfs; unsigned long vn_vno; int vn_mode; int vn_len; link_list_t vn_link; kmutex_t vn_mutex; struct vnode_ops *vn_op; /* function pointers */ void *vn_i; /* extra stuff in subclasses */ } Operating Systems In Depth VII 42 Copyright 2018 Thomas W. Doeppner. All rights reserved.
This lecture is covered in Section 4.1 of the textbook.
This lecture is covered in Section 4.1 of the textbook. A Unix process s address space appears to be three regions of memory: a read-only text region (containing executable code); a read-write region consisting
More informationCS 33. Shells and Files. CS33 Intro to Computer Systems XX 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.
CS 33 Shells and Files CS33 Intro to Computer Systems XX 1 Copyright 2017 Thomas W. Doeppner. All rights reserved. Shells Command and scripting languages for Unix First shell: Thompson shell sh, developed
More informationCS 33. Files Part 2. CS33 Intro to Computer Systems XXI 1 Copyright 2018 Thomas W. Doeppner. All rights reserved.
CS 33 Files Part 2 CS33 Intro to Computer Systems XXI 1 Copyright 2018 Thomas W. Doeppner. All rights reserved. Directories unix etc home pro dev passwd motd twd unix... slide1 slide2 CS33 Intro to Computer
More informationProcess Creation in UNIX
Process Creation in UNIX int fork() create a child process identical to parent Child process has a copy of the address space of the parent process On success: Both parent and child continue execution at
More informationFall 2017 :: CSE 306. File Systems Basics. Nima Honarmand
File Systems Basics Nima Honarmand File and inode File: user-level abstraction of storage (and other) devices Sequence of bytes inode: internal OS data structure representing a file inode stands for index
More informationCS 33. Architecture and the OS. CS33 Intro to Computer Systems XIX 1 Copyright 2018 Thomas W. Doeppner. All rights reserved.
CS 33 Architecture and the OS CS33 Intro to Computer Systems XIX 1 Copyright 2018 Thomas W. Doeppner. All rights reserved. The Operating System My Program Mary s Program Bob s Program OS CS33 Intro to
More informationRicardo Rocha. Department of Computer Science Faculty of Sciences University of Porto
Ricardo Rocha Department of Computer Science Faculty of Sciences University of Porto For more information please consult Advanced Programming in the UNIX Environment, 3rd Edition, W. Richard Stevens and
More informationContents. IPC (Inter-Process Communication) Representation of open files in kernel I/O redirection Anonymous Pipe Named Pipe (FIFO)
Pipes and FIFOs Prof. Jin-Soo Kim( jinsookim@skku.edu) TA JinHong Kim( jinhong.kim@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Contents IPC (Inter-Process Communication)
More informationProcesses often need to communicate. CSCB09: Software Tools and Systems Programming. Solution: Pipes. Recall: I/O mechanisms in C
2017-03-06 Processes often need to communicate CSCB09: Software Tools and Systems Programming E.g. consider a shell pipeline: ps wc l ps needs to send its output to wc E.g. the different worker processes
More informationCS 33. Architecture and the OS. CS33 Intro to Computer Systems XIX 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.
CS 33 Architecture and the OS CS33 Intro to Computer Systems XIX 1 Copyright 2017 Thomas W. Doeppner. All rights reserved. The Operating System My Program Mary s Program Bob s Program OS CS33 Intro to
More informationOutline. OS Interface to Devices. System Input/Output. CSCI 4061 Introduction to Operating Systems. System I/O and Files. Instructor: Abhishek Chandra
Outline CSCI 6 Introduction to Operating Systems System I/O and Files File I/O operations File Descriptors and redirection Pipes and FIFOs Instructor: Abhishek Chandra 2 System Input/Output Hardware devices:
More informationFile Descriptors and Piping
File Descriptors and Piping CSC209: Software Tools and Systems Programming Furkan Alaca & Paul Vrbik University of Toronto Mississauga https://mcs.utm.utoronto.ca/~209/ Week 8 Today s topics File Descriptors
More informationLogical disks. Bach 2.2.1
Logical disks Bach 2.2.1 Physical disk is divided into partitions or logical disks Logical disk linear sequence of fixed size, randomly accessible, blocks disk device driver maps underlying physical storage
More informationDisk divided into one or more partitions
UNIX File System Filesystem structure Disk divided into one or more partitions independent file system on each partition Sector 0 contains the Master Boot Record (MBR) MBR contains partition table one
More informationSystems Programming. COSC Software Tools. Systems Programming. High-Level vs. Low-Level. High-Level vs. Low-Level.
Systems Programming COSC 2031 - Software Tools Systems Programming (K+R Ch. 7, G+A Ch. 12) The interfaces we use to work with the operating system In this case: Unix Programming at a lower-level Systems
More informationWindows 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 information3/26/2014. Contents. Concepts (1) Disk: Device that stores information (files) Many files x many users: OS management
2013-2014 Contents 1. Concepts about the file system 2. The The disk user structure view 3. 2. Files The disk in disk structure The ext2 FS 4. 3. The Files Virtual in disk File The System ext2 FS 4. The
More informationProcesses 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 informationUNIX System Calls. Sys Calls versus Library Func
UNIX System Calls Entry points to the kernel Provide services to the processes One feature that cannot be changed Definitions are in C For most system calls a function with the same name exists in the
More informationMaria Hybinette, UGA. ! One easy way to communicate is to use files. ! File descriptors. 3 Maria Hybinette, UGA. ! Simple example: who sort
Two Communicating Processes Hello Gunnar CSCI 6730/ 4730 Operating Systems Process Chat Maria A Hi Nice to Hear from you Process Chat Gunnar B Dup & Concept that we want to implement 2 On the path to communication
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" Unix system-level functions for I/O" The Unix stream
More informationCSC209H Lecture 6. Dan Zingaro. February 11, 2015
CSC209H Lecture 6 Dan Zingaro February 11, 2015 Zombie Children (Kerrisk 26.2) As with every other process, a child process terminates with an exit status This exit status is often of interest to the parent
More informationPipes and FIFOs. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University
Pipes and FIFOs Woo-Yeong Jeong (wooyeong@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Open Files in Kernel How the Unix kernel represents open files? Two descriptors
More informationOperating Systems. Lecture 06. System Calls (Exec, Open, Read, Write) Inter-process Communication in Unix/Linux (PIPE), Use of PIPE on command line
Operating Systems Lecture 06 System Calls (Exec, Open, Read, Write) Inter-process Communication in Unix/Linux (PIPE), Use of PIPE on command line March 04, 2013 exec() Typically the exec system call is
More informationHyo-bong Son Computer Systems Laboratory Sungkyunkwan University
File I/O Hyo-bong Son (proshb@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Unix Files A Unix file is a sequence of m bytes: B 0, B 1,..., B k,..., B m-1 All I/O
More informationBasic 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 informationBasic 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 informationSection 3: File I/O, JSON, Generics. Meghan Cowan
Section 3: File I/O, JSON, Generics Meghan Cowan POSIX Family of standards specified by the IEEE Maintains compatibility across variants of Unix-like OS Defines API and standards for basic I/O: file, terminal
More informationSE350: Operating Systems
SE350: Operating Systems Tutorial: The Programming Interface Main Points Creating and managing processes fork, exec, wait Example: implementing a shell Shell A shell is a job control system Allows programmer
More informationOutline. Relationship between file descriptors and open files
Outline 3 File I/O 3-1 3.1 File I/O overview 3-3 3.2 open(), read(), write(), and close() 3-7 3.3 The file offset and lseek() 3-21 3.4 Atomicity 3-30 3.5 Relationship between file descriptors and open
More informationVirtual File System. Don Porter CSE 306
Virtual File System Don Porter CSE 306 History Early OSes provided a single file system In general, system was pretty tailored to target hardware In the early 80s, people became interested in supporting
More informationProcesses. Processes (cont d)
Processes UNIX process creation image-file arg1 arg2 Shell command line example ls -l Equivalent to /bin/ls -l Why? How do you find out where the image file is? Background processes ls -l & Execute a process
More informationCS240: Programming in C
CS240: Programming in C Lecture 15: Unix interface: low-level interface Cristina Nita-Rotaru Lecture 15/Fall 2013 1 Streams Recap Higher-level interface, layered on top of the primitive file descriptor
More informationLecture files in /home/hwang/cs375/lecture05 on csserver.
Lecture 5 Lecture files in /home/hwang/cs375/lecture05 on csserver. cp -r /home/hwang/cs375/lecture05. scp -r user@csserver.evansville.edu:/home/hwang/cs375/lecture05. Project 1 posted, due next Thursday
More informationComputer Programming Lecture 1 이윤진서울대학교
Computer Programming Lecture 1 이윤진서울대학교 2007.12.20. Slide Credits 엄현상교수님 서울대학교컴퓨터공학부 Computer Programming, g, 2007 봄학기 순서 강의소개 강의목표 강의개요 수업진행방법및평가 UNIX/LINUX 기초 주요기능 주요기능 파일시스템 강의목표 Unix/Linux 중심의프로그래밍
More informationContents. PA1 review and introduction to PA2. IPC (Inter-Process Communication) Exercise. I/O redirection Pipes FIFOs
Pipes and FIFOs Prof. Jin-Soo Kim( jinsookim@skku.edu) TA Dong-Yun Lee(dylee@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Contents PA1 review and introduction to
More informationOperating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst
Operating Systems CMPSCI 377 Spring 2017 Mark Corner University of Massachusetts Amherst Clicker Question #1 For a sequential workload, the limiting factor for a disk system is likely: (A) The speed of
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 informationThe bigger picture. File systems. User space operations. What s a file. A file system is the user space implementation of persistent storage.
The bigger picture File systems Johan Montelius KTH 2017 A file system is the user space implementation of persistent storage. a file is persistent i.e. it survives the termination of a process a file
More informationCS 25200: Systems Programming. Lecture 14: Files, Fork, and Pipes
CS 25200: Systems Programming Lecture 14: Files, Fork, and Pipes Dr. Jef Turkstra 2018 Dr. Jeffrey A. Turkstra 1 Lecture 14 File table and descriptors Fork and exec Fd manipulation Pipes 2018 Dr. Jeffrey
More informationRecitation 8: Tshlab + VM
Recitation 8: Tshlab + VM Instructor: TAs 1 Outline Labs Signals IO Virtual Memory 2 TshLab and MallocLab TshLab due Tuesday MallocLab is released immediately after Start early Do the checkpoint first,
More informationIntel P The course that gives CMU its Zip! P6/Linux Memory System November 1, P6 memory system. Review of abbreviations
15-213 The course that gives CMU its Zip! P6/Linux ory System November 1, 01 Topics P6 address translation Linux memory management Linux fault handling memory mapping Intel P6 Internal Designation for
More informationFile I/0. Advanced Programming in the UNIX Environment
File I/0 Advanced Programming in the UNIX Environment File Descriptors Created and managed by the UNIX kernel. Created using open or creat system call. Used to refer to an open file UNIX System shells
More informationSection 2: Processes
September 7, 2016 Contents 1 Warmup 2 1.1 Hello World............................................ 2 2 Vocabulary 2 3 Problems 3 3.1 Forks................................................ 3 3.2 Stack Allocation.........................................
More informationUNIVERSITY OF NEBRASKA AT OMAHA Computer Science 4500/8506 Operating Systems Fall Programming Assignment 1 (updated 9/16/2017)
UNIVERSITY OF NEBRASKA AT OMAHA Computer Science 4500/8506 Operating Systems Fall 2017 Programming Assignment 1 (updated 9/16/2017) Introduction The purpose of this programming assignment is to give you
More informationInput and Output System Calls
Chapter 2 Input and Output System Calls Internal UNIX System Calls & Libraries Using C --- 1011 OBJECTIVES Upon completion of this unit, you will be able to: Describe the characteristics of a file Open
More informationCS240: Programming in C
CS240: Programming in C Lecture 16: Process and Signals Cristina Nita-Rotaru Lecture 16/ Fall 2013 1 Processes in UNIX UNIX identifies processes via a unique Process ID Each process also knows its parent
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 informationCS 201. Files and I/O. Gerson Robboy Portland State University
CS 201 Files and I/O Gerson Robboy Portland State University A Typical Hardware System CPU chip register file ALU system bus memory bus bus interface I/O bridge main memory USB controller graphics adapter
More informationProcesses. Operating System CS 217. Supports virtual machines. Provides services: User Process. User Process. OS Kernel. Hardware
es CS 217 Operating System Supports virtual machines Promises each process the illusion of having whole machine to itself Provides services: Protection Scheduling Memory management File systems Synchronization
More informationI/O OPERATIONS. UNIX Programming 2014 Fall by Euiseong Seo
I/O OPERATIONS UNIX Programming 2014 Fall by Euiseong Seo Files Files that contain a stream of bytes are called regular files Regular files can be any of followings ASCII text Data Executable code Shell
More informationInter-Process Communication
CS 326: Operating Systems Inter-Process Communication Lecture 10 Today s Schedule Shared Memory Pipes 2/28/18 CS 326: Operating Systems 2 Today s Schedule Shared Memory Pipes 2/28/18 CS 326: Operating
More informationCOP4342 UNIX Tools Assignment #3: A Simple Unix Shell. Instructor: Dr. Robert Van Engelen Teaching Assistant: Imran Chowdhury Spring 2018
Total Points: 100 COP4342 UNIX Tools Assignment #3: A Simple Unix Shell Instructor: Dr. Robert Van Engelen Teaching Assistant: Imran Chowdhury Spring 2018 Description: The bash shell utility on UNIX and
More informationP6 memory system P6/Linux Memory System October 31, Overview of P6 address translation. Review of abbreviations. Topics. Symbols: ...
15-213 P6/Linux ory System October 31, 00 Topics P6 address translation Linux memory management Linux fault handling memory mapping DRAM bus interface unit instruction fetch unit processor package P6 memory
More informationCSE 410: Systems Programming
CSE 410: Systems Programming Pipes and Redirection Ethan Blanton Department of Computer Science and Engineering University at Buffalo Interprocess Communication UNIX pipes are a form of interprocess communication
More 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 informationPage Which had internal designation P5
Intel P6 Internal Designation for Successor to Pentium Which had internal designation P5 Fundamentally Different from Pentium 1 Out-of-order, superscalar operation Designed to handle server applications
More informationThe Classical OS Model in Unix
The Classical OS Model in Unix Nachos Exec/Exit/Join Example Exec parent Join Exec child Exit SpaceID pid = Exec( myprogram, 0); Create a new process running the program myprogram. int status = Join(pid);
More informationA2 Design Considerations. CS161, Spring
A2 Design Considerations CS161, Spring 2014 http://goo.gl/izxych Agenda 1. processes 2. file descriptors 3. fork 4. waitpid & exit 5. exec 6. scheduler 7. suggestions for testing 8. lessons learned from
More informationHousekeeping (Lecture 12-6/26/2018)
Operating Systems - CSCI 42 Housekeeping (Lecture 12-6/26/218) Cheating on roll sheet signing constitutes academic dishonesty and will result in an F in the class Kernel 1 is due at 11:45pm this Tuesday,
More informationIntel P6 (Bob Colwell s Chip, CMU Alumni) The course that gives CMU its Zip! Memory System Case Studies November 7, 2007.
class.ppt 15-213 The course that gives CMU its Zip! ory System Case Studies November 7, 07 Topics P6 address translation x86-64 extensions Linux memory management Linux fault handling ory mapping Intel
More informationI/O OPERATIONS. UNIX Programming 2014 Fall by Euiseong Seo
I/O OPERATIONS UNIX Programming 2014 Fall by Euiseong Seo Files Files that contain a stream of bytes are called regular files Regular files can be any of followings ASCII text Data Executable code Shell
More informationCSI 402 Lecture 11 (Unix Discussion on Files continued) 11 1 / 19
CSI 402 Lecture 11 (Unix Discussion on Files continued) 11 1 / 19 User and Group IDs Ref: Chapter 3 of [HGS]. Each user is given an ID (integer) called uid. (Most system programs use uid instead of the
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 informationOS COMPONENTS OVERVIEW OF UNIX FILE I/O. CS124 Operating Systems Fall , Lecture 2
OS COMPONENTS OVERVIEW OF UNIX FILE I/O CS124 Operating Systems Fall 2017-2018, Lecture 2 2 Operating System Components (1) Common components of operating systems: Users: Want to solve problems by using
More informationCMSC 216 Introduction to Computer Systems Lecture 17 Process Control and System-Level I/O
CMSC 216 Introduction to Computer Systems Lecture 17 Process Control and System-Level I/O Sections 8.2-8.5, Bryant and O'Hallaron PROCESS CONTROL (CONT.) CMSC 216 - Wood, Sussman, Herman, Plane 2 Signals
More informationPrepared by Prof. Hui Jiang Process. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University
EECS3221.3 Operating System Fundamentals No.2 Process Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University How OS manages CPU usage? How CPU is used? Users use CPU to run
More informationUNIX. Session 2. UNIX processes and forking fork system call exec system call death of process kill fork and I/O using it UNIX.
ProgrammingII Session 2 process handling processes and forking fork system call exec system call death of process kill fork and I/O using it ProgrammingII Short Course Notes Alan Dix 1996 II/20 process:
More informationProcess. Prepared by Prof. Hui Jiang Dept. of EECS, York Univ. 1. Process in Memory (I) PROCESS. Process. How OS manages CPU usage? No.
EECS3221.3 Operating System Fundamentals No.2 Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University How OS manages CPU usage? How CPU is used? Users use CPU to run programs
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 informationUNIX System Programming. Overview. 1. A UNIX System. 2. Processes (review) 2.1. Context. Pipes/FIFOs
UNIX System Programming Pipes/FIFOs Overview 1. A UNIX System (review) 2. Processes (review) Objectives Look at UNIX support for interprocess communication (IPC) on a single machine Review processes pipes,
More informationCS2028 -UNIX INTERNALS
DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY,SIRUVACHUR-621113. CS2028 -UNIX INTERNALS PART B UNIT 1 1. Explain briefly details about History of UNIX operating system? In 1965, Bell Telephone
More informationUNIX File Management (continued)
UNIX File Management (continued) OS storage stack (recap) Application FD table OF table VFS FS Buffer cache Disk scheduler Device driver 2 Virtual File System (VFS) Application FD table OF table VFS FS
More informationLast Week: ! Efficiency read/write. ! The File. ! File pointer. ! File control/access. This Week: ! How to program with directories
Overview Unix System Programming Directories and File System Last Week:! Efficiency read/write! The File! File pointer! File control/access This Week:! How to program with directories! Brief introduction
More informationCS167 Programming Assignment 1: Shell
CS167 Programming Assignment 1: Assignment Out: Sep. 5, 2007 Helpsession: Sep. 11, 2007 (8:00 pm, Motorola Room, CIT 165) Assignment Due: Sep. 17, 2007 (11:59 pm) 1 Introduction In this assignment you
More informationApplications of. Virtual Memory in. OS Design
Applications of Virtual Memory in OS Design Nima Honarmand Introduction Virtual memory is a powerful level of indirection Indirection: IMO, the most powerful concept in Computer Science Fundamental Theorem
More informationOperating System Labs. Yuanbin Wu
Operating System Labs Yuanbin Wu cs@ecnu Annoucement Next Monday (28 Sept): We will have a lecture @ 4-302, 15:00-16:30 DON'T GO TO THE LABORATORY BUILDING! TA email update: ecnucchuang@163.com ecnucchuang@126.com
More informationCSE 333 SECTION 3. POSIX I/O Functions
CSE 333 SECTION 3 POSIX I/O Functions Administrivia Questions (?) HW1 Due Tonight Exercise 7 due Monday (out later today) POSIX Portable Operating System Interface Family of standards specified by the
More informationFiles and Directories
Files and Directories Administrative * HW# 1 Due this week Goals: Understand the file system concepts * files, links, and directories * device independent interface Topics: * 3.0 Device independence *
More informationChp1 Introduction. Introduction. Objective. Logging In. Shell. Briefly describe services provided by various versions of the UNIX operating system.
Chp1 Objective Briefly describe services provided by various versions of the UNIX operating system. Logging In /etc/passwd local machine or NIS DB root:x:0:1:super-user:/root:/bin/tcsh Login-name, encrypted
More informationPreview. Process Control. What is process? Process identifier The fork() System Call File Sharing Race Condition. COSC350 System Software, Fall
Preview Process Control What is process? Process identifier The fork() System Call File Sharing Race Condition COSC350 System Software, Fall 2015 1 Von Neumann Computer Architecture: An integrated set
More informationUnix File and I/O. Outline. Storing Information. File Systems. (USP Chapters 4 and 5) Instructor: Dr. Tongping Liu
Outline Unix File and I/O (USP Chapters 4 and 5) Instructor: Dr. Tongping Liu Basics of File Systems Directory and Unix File System: inode UNIX I/O System Calls: open, close, read, write, ioctl File Representations:
More informationLab 4. Out: Friday, February 25th, 2005
CS034 Intro to Systems Programming Doeppner & Van Hentenryck Lab 4 Out: Friday, February 25th, 2005 What you ll learn. In this lab, you ll learn to use function pointers in a variety of applications. You
More informationAdvanced Unix/Linux System Program. Instructor: William W.Y. Hsu
Advanced Unix/Linux System Program Instructor: William W.Y. Hsu CONTENTS File I/O, File Sharing 3/15/2018 INTRODUCTION TO COMPETITIVE PROGRAMMING 2 Recall simple-cat.c... /* * Stripped down version of
More informationeverything is a file main.c a.out /dev/sda1 /dev/tty2 /proc/cpuinfo file descriptor int
everything is a file main.c a.out /dev/sda1 /dev/tty2 /proc/cpuinfo file descriptor int #include #include #include int open(const char *path, int flags); flagso_rdonly
More informationMemory System Case Studies Oct. 13, 2008
Topics 15-213 Memory System Case Studies Oct. 13, 2008 P6 address translation x86-64 extensions Linux memory management Linux page fault handling Memory mapping Class15+.ppt Intel P6 (Bob Colwell s Chip,
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 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 informationRCU. ò Walk through two system calls in some detail. ò Open and read. ò Too much code to cover all FS system calls. ò 3 Cases for a dentry:
Logical Diagram VFS, Continued Don Porter CSE 506 Binary Formats RCU Memory Management File System Memory Allocators System Calls Device Drivers Networking Threads User Today s Lecture Kernel Sync CPU
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 informationVFS, Continued. Don Porter CSE 506
VFS, Continued Don Porter CSE 506 Logical Diagram Binary Formats Memory Allocators System Calls Threads User Today s Lecture Kernel RCU File System Networking Sync Memory Management Device Drivers CPU
More informationPentium/Linux Memory System March 17, 2005
15-213 The course that gives CMU its Zip! Topics Pentium/Linux Memory System March 17, 2005 P6 address translation x86-64 extensions Linux memory management Linux page fault handling Memory mapping 17-linuxmem.ppt
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 informationWhat Is Operating System? Operating Systems, System Calls, and Buffered I/O. Academic Computers in 1983 and Operating System
What Is Operating System? Operating Systems, System Calls, and Buffered I/O emacs gcc Browser DVD Player Operating System CS 217 1 Abstraction of hardware Virtualization Protection and security 2 Academic
More informationCSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song
CSCE 313 Introduction to Computer Systems Instructor: Dezhen Song UNIX I/O Files and File Representation Basic operations: Reading / Writing Caching: File Open / Close Multiplexing: Select / Poll File
More informationVirtual File System. Don Porter CSE 506
Virtual File System Don Porter CSE 506 History ò Early OSes provided a single file system ò In general, system was pretty tailored to target hardware ò In the early 80s, people became interested in supporting
More informationWeek 2 Intro to the Shell with Fork, Exec, Wait. Sarah Diesburg Operating Systems CS 3430
Week 2 Intro to the Shell with Fork, Exec, Wait Sarah Diesburg Operating Systems CS 3430 1 Why is the Shell Important? Shells provide us with a way to interact with the core system Executes programs on
More informationSolutions to the first midterm. COSC 4330/6310 Summer 2013
Solutions to the first midterm COSC 4330/6310 Summer 2013 First question a) Give an example of a popular operating system using a UNIX or a Linux kernel. b) Give an example of a real-time process with
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 information