5. Processes and Memory Management
|
|
|
- Corey Nicholson
- 10 years ago
- Views:
Transcription
1 5. Processes and Memory Management 5. Processes and Memory Management Process Abstraction Introduction to Memory Management Process Implementation States and Scheduling Programmer Interface Process Genealogy Daemons, Sessions and Groups 89 / 352
2 5. Processes and Memory Management Process Abstraction 5. Processes and Memory Management Process Abstraction Introduction to Memory Management Process Implementation States and Scheduling Programmer Interface Process Genealogy Daemons, Sessions and Groups 90 / 352
3 5. Processes and Memory Management Process Abstraction Logical Separation of Processes Kernel Address Space for a Process Process descriptor Memory mapping Open file descriptors Current directory Pointer to kernel stack Kernel stack Small by default; grows in extreme cases of nested interrupts/exceptions Process table Associative table of PID-indexed process descriptors Doubly-linked tree (links to both children and parent) 91 / 352
4 5. Processes and Memory Management Process Abstraction Logical Separation of Processes User Address Space for a Process 0xbfffffff Stack Allocated and initialized when loading and executing the program Memory accesses in user mode are restricted to this address space Heap Free space Static (initialized and bss) Code (a.k.a. text) 0x / 352
5 5. Processes and Memory Management Process Abstraction Logical Segments in Virtual Memory Per-Process Virtual Memory Layout Code (also called text) segment Linux: ELF format for object files (.o and executable) Static Data segments Initialized global (and C static) variables Uninitialized global variables Stack segment Zeroed when initializing the process, also called bss Stack frames of function calls Arguments and local variables, also called automatic variables in C Heap segment Dynamic allocation (malloc()) 0xbfffffff Stack Free space Heap Static (initialized and bss) Code (a.k.a. text) 0x / 352
6 5. Processes and Memory Management Process Abstraction System Call: brk() Resize the Heap Segment #include <unistd.h> int brk(void *end_data_segment); void *sbrk(intptr_t displacement); Semantics Sets the end of the data segment, which is also the end of the heap brk() sets the address directly and returns 0 on success sbrk() adds a displacement (possibly 0) and returns the starting address of the new area (it is a C function, front-end to sbrk()) Both are deprecated as programmer interface functions, i.e., they are meant for kernel development only 94 / 352
7 5. Processes and Memory Management Process Abstraction Memory Address Space Example #include <stdlib.h> #include <stdio.h> double t[0x ]; void segments() { static int s = 42; void *p = malloc(1024); } printf("stack\t%010p\nbrk\t%010p\nheap\t%010p\n" "static\t%010p\nstatic\t%010p\ntext\t%010p\n", &p, sbrk(0), p, t, &s, segments); int main(int argc, char *argv[]) { segments(); exit(0); } 95 / 352
8 5. Processes and Memory Management Process Abstraction Memory Address Space Example #include <stdlib.h> #include <stdio.h> double t[0x ]; void segments() { static int s = 42; void *p = malloc(1024); Sample Output stack 0xbff86fe0 brk 0x1806b000 heap 0x1804a008 static (bss) 0x static (initialized) 0x080496e4 text 0x080483f4 } printf("stack\t%010p\nbrk\t%010p\nheap\t%010p\n" "static\t%010p\nstatic\t%010p\ntext\t%010p\n", &p, sbrk(0), p, t, &s, segments); int main(int argc, char *argv[]) { segments(); exit(0); } 95 / 352
9 5. Processes and Memory Management Introduction to Memory Management 5. Processes and Memory Management Process Abstraction Introduction to Memory Management Process Implementation States and Scheduling Programmer Interface Process Genealogy Daemons, Sessions and Groups 96 / 352
10 5. Processes and Memory Management Introduction to Memory Management Introduction to Memory Management Paging Basics Processes access memory through virtual addresses Simulates a large interval of memory addresses Simplifies memory management Automatic translation to physical addresses by the CPU (MMU/TLB circuits) Paging mechanism Provide a protection mechanism for memory regions, called pages Fixed 2 n page size(s), e.g., 4kB and 2MB on x86 The kernel implements a mapping of physical pages to virtual ones Different for every process Key mechanism to ensure logical separation of processes Hides kernel and other processes memory Expressive and efficient address-space protection and separation 97 / 352
11 5. Processes and Memory Management Introduction to Memory Management Address Translation for Paged Memory VIRTUAL ADDRESS DIRECTORY TABLE OFFSET Page Page Table DATA Page Directory Paging Control Register PHYSICAL ADDRESS 98 / 352
12 5. Processes and Memory Management Introduction to Memory Management Page Table Actions 99 / 352
13 5. Processes and Memory Management Introduction to Memory Management Page Table Structure(s) Page Table Entry Physical address Valid/Dirty/Accessed Kernel R/W/X User R/W/X Physical Page Mapping E.g., Linux s mem map t structure: counter how many users are mapping a physical page age timestamp for swapping heuristics: Belady algorithm map nr Physical page number Plus a free area for page allocation and dealocation 100 / 352
14 5. Processes and Memory Management Introduction to Memory Management Saving Resources and Enhancing Performance Lazy Memory Management Motivation: high-performance memory allocation Demand-paging: delay the allocation of a memory page and its mapping to the process s virtual address space until the process accesses an address in the range associated with this page Allows overcommitting: more economical than eager allocation (like overbooking in public transportation) Motivation: high-performance process creation Copy-on-write: when cloning a process, do not replicate its memory, but mark its pages as need to be copied on the next write access Critical for UNIX Software Caches Cloning is the only way to create a new process Child processes are often short-lived: they are quickly overlapped by the execution of another program (see execve()) Buffer cache for block devices, and page cache for file data Swap cache to keep track of clean pages in the swap (disk) 101 / 352
15 5. Processes and Memory Management Introduction to Memory Management C Library Function: malloc() Allocate Dynamic Memory #include <stdlib.h> void *malloc(size_t size); Semantics On success, returns a pointer to a fresh interval of size bytes of heap memory Return NULL on error See also calloc() and realloc() 102 / 352
16 5. Processes and Memory Management Introduction to Memory Management C Library Function: malloc() Allocate Dynamic Memory #include <stdlib.h> void *malloc(size_t size); Semantics On success, returns a pointer to a fresh interval of size bytes of heap memory Return NULL on error See also calloc() and realloc() Warning: many OSes overcommit memory by default (e.g., Linux) Minimal memory availability check and optimistically return non-null Assume processes will not use all the memory they requested When the system really runs out of free physical pages (after all swap space has been consumed), a kernel heuristic selects a non-root process and kills it to free memory for the requester (quite unsatisfactory, but often sufficient) 102 / 352
17 5. Processes and Memory Management Introduction to Memory Management System Call: free() Free Dynamic Memory #include <stdlib.h> void free(void *ptr); Semantics Frees the memory interval pointed to by ptr, which must be the return value of a previous malloc() Undefined behaviour if it is not the case (very nasty in general, because the bug may reveal much later) No operation is performed if ptr is NULL The dedicated valgrind tool instruments memory accesses and system calls to track memory leaks, phantom pointers, corrupt calls to free(), etc. 103 / 352
18 5. Processes and Memory Management Introduction to Memory Management Memory Management of User Processes Memory Allocation Appears in every aspect of the system Major performance impact: highly optimized Free list: record linked list of free zones in the free memory space only Record the address of the next free zone Record the size of the allocated zone prior to its effective bottom address FreeSize 2 FreeNext 2 Free 2 Allocated 2 Size 2 AllocatedSize 2 FreeNext Allocated 1 Size 1 AllocatedSize 1 Free 1 FreeSize 1 FreeNext / 352
19 5. Processes and Memory Management Introduction to Memory Management Memory Management of User Processes Memory Allocation Appears in every aspect of the system Major performance impact: highly optimized Buddy system: allocate contiguous pages of physical memory Coupled with free list for intra-page allocation Contiguous physical pages improve performance (better TLB usage and DRAM control) Intervals: A: 64kB B: 128kB C: 64kB D: 128kB Empty 1024 Allocate A A Allocate B A 64 B Allocate C A C B Allocate D A C B D Free C A 64 B D Free A 128 B D Free B 256 D Free D / 352
20 5. Processes and Memory Management Process Implementation 5. Processes and Memory Management Process Abstraction Introduction to Memory Management Process Implementation States and Scheduling Programmer Interface Process Genealogy Daemons, Sessions and Groups 105 / 352
21 5. Processes and Memory Management Process Implementation Process Descriptor Main Fields of the Descriptor State Kernel stack Flags Memory map Parent TTY Thread Files Limits Signals ready/running, stopped, zombie... typically one memory page e.g., FD CLOEXEC pointer to table of memory page descriptors (maps) pointer to parent process (allow to obtain PPID) control terminal (if any) TID and thread information current directory and table of file descriptors resource limits, see getrlimit() signal handlers, masked and pending signals 106 / 352
22 5. Processes and Memory Management Process Implementation Operations on Processes Basic Operations on Processes Cloning fork() system call, among others Joining (see next chapter) wait() system call, among others Signaling events (see next chapter) kill() system call, signal handlers 107 / 352
23 5. Processes and Memory Management Process Implementation Creating Processes Process Duplication Generate a clone of the parent process The child is almost identical It executes the same program In a copy of its virtual memory space fork system call parent child 108 / 352
24 5. Processes and Memory Management States and Scheduling 5. Processes and Memory Management Process Abstraction Introduction to Memory Management Process Implementation States and Scheduling Programmer Interface Process Genealogy Daemons, Sessions and Groups 109 / 352
25 5. Processes and Memory Management States and Scheduling Process States CONT signal STOP signal preemption ptrace Stopped Traced Create fork Ready Running exit suspend (e.g., I/O) Zombie parent wait Delete Suspended Ready (runnable) process waits to be scheduled Running process make progress on a hardware thread Stopped process awaits a continuation signal Suspended process awaits a wake-up condition from the kernel Traced process awaits commands from the debugger Zombie process retains termination status until parent is notified Child created as Ready after fork() Parent is Stopped between vfork() and child execve() 110 / 352
26 5. Processes and Memory Management States and Scheduling Process Scheduling Preemption Default for multiprocessing environments Fixed time quota (typically 1ms to 10ms) Some processes, called real-time, may not be preempted Process 1 Process 2 Process 1 USER MODE KERNEL MODE Time Time quota Scheduler Scheduler Timer interrupt Preemption Yield Voluntary suspension 111 / 352
27 5. Processes and Memory Management States and Scheduling Process Scheduling Voluntary Yield Suspend execution and yield to the kernel E.g., I/O or synchronization Only way to enable a context switch for real-time processes Process 1 Process 2 Process 1 USER MODE KERNEL MODE Time Time quota Scheduler Scheduler Timer interrupt Preemption Yield Voluntary suspension 112 / 352
28 5. Processes and Memory Management Programmer Interface 5. Processes and Memory Management Process Abstraction Introduction to Memory Management Process Implementation States and Scheduling Programmer Interface Process Genealogy Daemons, Sessions and Groups 113 / 352
29 5. Processes and Memory Management Programmer Interface System Call: fork() Create a Child Process #include <sys/types.h> #include <unistd.h> pid_t fork(); Semantics The child process is identical to its parent, except: Its PID and PPID (parent process ID) Zero resource utilization (initially, relying on copy-on-write) No pending signals, file locks, inter-process communication objects On success, returns the child PID in the parent, and 0 in the child Simple way to detect from the inside which of the child or parent runs See also getpid(), getppid() Return 1 on error Linux: clone() is more general, for both process and thread creation 114 / 352
30 5. Processes and Memory Management Programmer Interface System Call: fork() Create a Child Process #include <sys/types.h> #include <unistd.h> pid_t fork(); Typical Usage switch (cpid = fork()) { case -1: // Error perror(" my_function : fork() failed"); exit(1); case 0: // The child executes continue_child(); break; default: // The parent executes continue_parent(cpid); // Pass child PID for future reference } 115 / 352
31 5. Processes and Memory Management Programmer Interface System Call: execve() and variants Execute a Program #include <unistd.h> int execve(const char *filename, char *const argv[], char *const envp[]); Semantics Arguments: absolute path, argument array (a.k.a. vector), environment array (shell environment variables) On success, the call does not return! Overwrites the process s text, data, bss, stack segments with those of the loaded program Preserve PID, PPID, open file descriptors Except if made FD CLOEXEC with fcntl() If the file has an SUID (resp. SGID) bit, set the effective UID (resp. GID) of the process to the file s owner (resp. group) Return 1 on error 116 / 352
32 5. Processes and Memory Management Programmer Interface System Call: execve() and variants Execute a Program #include <unistd.h> int execve(const char *filename, char *const argv[], char *const envp[]); Error Conditions Typical errno codes EACCES: execute permission denied (among other explanations) ENOEXEC: non-executable format, or executable file for the wrong OS or processor architecture 116 / 352
33 5. Processes and Memory Management Programmer Interface System Call: execve() and variants Execute a Program: Variants #include <unistd.h> int execl(const char *path, const char *arg,...); int execv(const char *path, char *const argv[]); int execlp(const char *file, const char *arg,...); int execvp(const char *file, char *const argv[]); int execle(const char *path, const char * arg,..., char *const envp[]); int execve(const char *filename, char *const argv[], char *const envp[]); Arguments execl() operates on NULL-terminated argument list Warning: arg, the first argument after the pathname/filename corresponds to argv[0] (the program name) execv() operates on argument array execlp() and execvp() are $PATH-relative variants (if file does not contain a / character) execle() also provides an environment 117 / 352
34 5. Processes and Memory Management Programmer Interface System Call: execve() and variants Execute a Program: Variants #include <unistd.h> int execl(const char *path, const char *arg,...); int execv(const char *path, char *const argv[]); int execlp(const char *file, const char *arg,...); int execvp(const char *file, char *const argv[]); int execle(const char *path, const char * arg,..., char *const envp[]); int execve(const char *filename, char *const argv[], char *const envp[]); Environment Note about environment variables They may be manipulated through getenv() and setenv() To retrieve the whole array, declare the global variable extern char **environ; and use it as argument of execve() or execle() More information: $ man 7 environ 117 / 352
35 5. Processes and Memory Management Programmer Interface I/O System Call: fcntl() Manipulate a File Descriptor #include <unistd.h> #include <fcntl.h> int fcntl(int fd, int cmd); int fcntl(int fd, int cmd, long arg); Some More Commands F GETFD: get the file descriptor flags F SETFD: set the file descriptor flags to the value of arg Only FD CLOEXEC is defined: sets the file descriptor to be closed upon calls to execve() (typically a security measure) 118 / 352
36 5. Processes and Memory Management Programmer Interface I/O System Call: fcntl() Manipulate a File Descriptor #include <unistd.h> #include <fcntl.h> int fcntl(int fd, int cmd); int fcntl(int fd, int cmd, long arg); Return Value On success, fcntl() returns a (non-negative) value which depends on the command F GETFD: the descriptor s flags F GETFD: 0 Return 1 on error 118 / 352
37 5. Processes and Memory Management Programmer Interface System Call: exit() Terminate the Current Process #include <unistd.h> void _exit(int status); Purpose Terminates the calling process Closes any open file descriptor Frees all memory pages of the process address space (except shared ones) Any child processes are inherited by process 1 (init) The parent process is sent a SIGCHLD signal (ignored by default) If the process is a session leader and its controlling terminal also controls the session, disassociate the terminal from the session and send a SIGHUP signal to all processes in the foreground group (terminate process by default) The call never fails and does not return! 119 / 352
38 5. Processes and Memory Management Programmer Interface System Call: exit() Terminate the Current Process #include <unistd.h> void _exit(int status); Exit Code The exit code is a signed byte defined as (status & 0xff) 0 means normal termination, non-zero indicates an error/warning There is no standard list of exit codes It is collected with one of the wait() system calls 119 / 352
39 5. Processes and Memory Management Programmer Interface System Call: exit() C Library Front-End: exit() #include <stdlib.h> void exit(int status); Calls any function registered through atexit() (in reverse order of registration) Use this function rather than the low-level exit() system call 120 / 352
40 5. Processes and Memory Management Process Genealogy 5. Processes and Memory Management Process Abstraction Introduction to Memory Management Process Implementation States and Scheduling Programmer Interface Process Genealogy Daemons, Sessions and Groups 121 / 352
41 5. Processes and Memory Management Process Genealogy Bootstrap and Processes Genealogy Swapper Process Process 0 One per CPU (if multiprocessor) Built from scratch by the kernel and runs in kernel mode Uses statically-allocated data Constructs memory structures and initializes virtual memory Initializes the main kernel data structures Creates kernel threads (swap, kernel logging, etc.) Enables interrupts, and creates a kernel thread with PID = / 352
42 5. Processes and Memory Management Process Genealogy Bootstrap and Processes Genealogy Init Process One per machine (if multiprocessor) Shares all its data with process 0 Process 1 Completes the initalization of the kernel Switch to user mode Executes /sbin/init, becoming a regular process and burying the structures and address space of process 0 Executing /sbin/init Builds the OS environment From /etc/inittab: type of bootstrap sequence, control terminals From /etc/rc*.d: scripts to run system daemons Adopts all orphaned processes, continuously, until the system halts $ man init and $ man shutdown 123 / 352
43 5. Processes and Memory Management Process Genealogy Process Tree Simplified Tree From $ pstree more init-cron -dhclient3 -gdm---gdm-+-xorg -x-session-manag---ssh-agent -5*[getty] -gnome-terminal-+-bash-+-more -pstree -gnome-pty-helper -{gnome-terminal} -klogd -ksoftirqd -kthread-+-ata -2*[kjournald] -kswapd -syslogd -udevd 124 / 352
44 5. Processes and Memory Management Daemons, Sessions and Groups 5. Processes and Memory Management Process Abstraction Introduction to Memory Management Process Implementation States and Scheduling Programmer Interface Process Genealogy Daemons, Sessions and Groups 125 / 352
45 5. Processes and Memory Management Daemons, Sessions and Groups Example: Network Service Daemons Internet Super-Server inetd, initiated at boot time Listen on specific ports listed in /etc/services Each configuration line follows the format: service name port /protocol [aliases...] E.g., ftp 21/tcp Dispatch the work to predefined daemons see /etc/inetd.conf when receiving incomming connections on those ports Each configuration line follows the format: service name socket type protocol flags user name daemon path arguments E.g., ftp stream tcp nowait root /usr/bin/ftpd 126 / 352
46 5. Processes and Memory Management Daemons, Sessions and Groups Process Sessions and Groups Process Sessions Orthogonal to process hierarchy Session ID = PID of the leader of the session Typically associated to user login, interactive terminals, daemon processes The session leader sends the SIGHUP (hang up) signal to every process belonging to its session, and only if it belongs to the foreground group associated to the controlling terminal of the session Process Groups Orthogonal to process hierarchy Process Group ID = PID of the group leader General mechanism To distribute signals among processes upon global events (like SIGHUP) Interaction with terminals, e.g., stall background process writing to terminal To implement job control in shells $ program &, Ctrl-Z, fg, bg, jobs, %1, disown, etc. 127 / 352
47 5. Processes and Memory Management Daemons, Sessions and Groups System Call: setsid() Creating a New Session and Process Group #include <unistd.h> pid_t setsid(); Description If the calling process is not a process group leader Calling process is the leader and only process of a new group and session Process group ID and session ID of the calling process are set to the PID of the calling process Calling process has no controlling terminal any more Return the session ID of the calling process (its PID) If the calling process is a process group leader Return -1 and sets errno to EPERM Rationale: a process group leader cannot resign its responsibilities 128 / 352
48 5. Processes and Memory Management Daemons, Sessions and Groups System Call: setsid() Creating a Daemon (or Service) Process A daemon process is detached from any terminal, session or process group, is adopted by init, has no open standard input/output/error, has / for current directory Daemonization procedure 1 Call signal(sighup, SIG IGN) to ignore HUP signal (see signals chapter) 2 Call fork() in a process P 3 Terminate parent P, calling exit() (may send HUP to child if session leader) 4 Call setsid() in child C 5 Call signal(sighup, SIG DFL) to reset HUP handler (see signals chapter) 6 Change current directory, close descriptors 0, 1, 2, reset umask, etc. 7 Continue execution in child C Note: an alternative procedure with a double fork() and wait() in the grand-parent is possible, avoiding to ignore the HUP signal 129 / 352
49 5. Processes and Memory Management Daemons, Sessions and Groups System Call: setsid() Creating a Daemon (or Service) Process A daemon process is detached from any terminal, session or process group, is adopted by init, has no open standard input/output/error, has / for current directory Daemonization procedure 1 Call signal(sighup, SIG IGN) to ignore HUP signal (see signals chapter) 2 Call fork() in a process P 3 Terminate parent P, calling exit() (may send HUP to child if session leader) 4 Call setsid() in child C 5 Call signal(sighup, SIG DFL) to reset HUP handler (see signals chapter) 6 Change current directory, close descriptors 0, 1, 2, reset umask, etc. 7 Continue execution in child C Note: an alternative procedure with a double fork() and wait() in the grand-parent is possible, avoiding to ignore the HUP signal See, getsid(), tcgetsid(), setpgid(), etc. See also daemon(), not POSIX but convenient integrated solution 129 / 352
How To Understand How A Process Works In Unix (Shell) (Shell Shell) (Program) (Unix) (For A Non-Program) And (Shell).Orgode) (Powerpoint) (Permanent) (Processes
Content Introduction and History File I/O The File System Shell Programming Standard Unix Files and Configuration Processes Programs are instruction sets stored on a permanent medium (e.g. harddisc). Processes
Computer Systems II. Unix system calls. fork( ) wait( ) exit( ) How To Create New Processes? Creating and Executing Processes
Computer Systems II Creating and Executing Processes 1 Unix system calls fork( ) wait( ) exit( ) 2 How To Create New Processes? Underlying mechanism - A process runs fork to create a child process - Parent
CSI 402 Lecture 13 (Unix Process Related System Calls) 13 1 / 17
CSI 402 Lecture 13 (Unix Process Related System Calls) 13 1 / 17 System Calls for Processes Ref: Process: Chapter 5 of [HGS]. A program in execution. Several processes are executed concurrently by the
Process definition Concurrency Process status Process attributes PROCESES 1.3
Process Management Outline Main concepts Basic services for process management (Linux based) Inter process communications: Linux Signals and synchronization Internal process management Basic data structures:
Chapter 6, The Operating System Machine Level
Chapter 6, The Operating System Machine Level 6.1 Virtual Memory 6.2 Virtual I/O Instructions 6.3 Virtual Instructions For Parallel Processing 6.4 Example Operating Systems 6.5 Summary Virtual Memory General
CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study
CS 377: Operating Systems Lecture 25 - Linux Case Study Guest Lecturer: Tim Wood Outline Linux History Design Principles System Overview Process Scheduling Memory Management File Systems A review of what
ELEC 377. Operating Systems. Week 1 Class 3
Operating Systems Week 1 Class 3 Last Class! Computer System Structure, Controllers! Interrupts & Traps! I/O structure and device queues.! Storage Structure & Caching! Hardware Protection! Dual Mode Operation
Leak Check Version 2.1 for Linux TM
Leak Check Version 2.1 for Linux TM User s Guide Including Leak Analyzer For x86 Servers Document Number DLC20-L-021-1 Copyright 2003-2009 Dynamic Memory Solutions LLC www.dynamic-memory.com Notices Information
Linux Kernel Architecture
Linux Kernel Architecture Amir Hossein Payberah [email protected] Contents What is Kernel? Kernel Architecture Overview User Space Kernel Space Kernel Functional Overview File System Process Management
Example of Standard API
16 Example of Standard API System Call Implementation Typically, a number associated with each system call System call interface maintains a table indexed according to these numbers The system call interface
Operating Systems. 05. Threads. Paul Krzyzanowski. Rutgers University. Spring 2015
Operating Systems 05. Threads Paul Krzyzanowski Rutgers University Spring 2015 February 9, 2015 2014-2015 Paul Krzyzanowski 1 Thread of execution Single sequence of instructions Pointed to by the program
An Implementation Of Multiprocessor Linux
An Implementation Of Multiprocessor Linux This document describes the implementation of a simple SMP Linux kernel extension and how to use this to develop SMP Linux kernels for architectures other than
The Linux Kernel: Process Management. CS591 (Spring 2001)
The Linux Kernel: Process Management Process Descriptors The kernel maintains info about each process in a process descriptor, of type task_struct. See include/linux/sched.h Each process descriptor contains
7.2 Examining Processes on the Command Line
Chapter 7 Process Architecture and Control Concepts Covered Memory architecture of a process Memory structures Viewing memory layout Process structure Executable le format Process creation Process synchronization
Chapter 10 Case Study 1: LINUX
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 10 Case Study 1: LINUX History of UNIX and Linux UNICS PDP-11 UNIX Portable UNIX Berkeley UNIX Standard UNIX MINIX Linux UNIX/Linux Goals
SYSTEM ecos Embedded Configurable Operating System
BELONGS TO THE CYGNUS SOLUTIONS founded about 1989 initiative connected with an idea of free software ( commercial support for the free software ). Recently merged with RedHat. CYGNUS was also the original
Processes and Non-Preemptive Scheduling. Otto J. Anshus
Processes and Non-Preemptive Scheduling Otto J. Anshus 1 Concurrency and Process Challenge: Physical reality is Concurrent Smart to do concurrent software instead of sequential? At least we want to have
Lecture 25 Systems Programming Process Control
Lecture 25 Systems Programming Process Control A process is defined as an instance of a program that is currently running. A uni processor system or single core system can still execute multiple processes
Virtual Memory. How is it possible for each process to have contiguous addresses and so many of them? A System Using Virtual Addressing
How is it possible for each process to have contiguous addresses and so many of them? Computer Systems Organization (Spring ) CSCI-UA, Section Instructor: Joanna Klukowska Teaching Assistants: Paige Connelly
Module 20: The Linux System
Module 20: The Linux System History Design Principles Kernel Modules Process Management Scheduling Memory Management File Systems Input and Output Interprocess Communication Network Structure Security
Introduction. dnotify
Introduction In a multi-user, multi-process operating system, files are continually being created, modified and deleted, often by apparently unrelated processes. This means that any software that needs
Lecture 5. User-Mode Linux. Jeff Dike. November 7, 2012. Operating Systems Practical. OSP Lecture 5, UML 1/33
Lecture 5 User-Mode Linux Jeff Dike Operating Systems Practical November 7, 2012 OSP Lecture 5, UML 1/33 Contents User-Mode Linux Keywords Resources Questions OSP Lecture 5, UML 2/33 Outline User-Mode
Introduction. What is an Operating System?
Introduction What is an Operating System? 1 What is an Operating System? 2 Why is an Operating System Needed? 3 How Did They Develop? Historical Approach Affect of Architecture 4 Efficient Utilization
CSE 120 Principles of Operating Systems. Modules, Interfaces, Structure
CSE 120 Principles of Operating Systems Fall 2000 Lecture 3: Operating System Modules, Interfaces, and Structure Geoffrey M. Voelker Modules, Interfaces, Structure We roughly defined an OS as the layer
Unix Security Technologies. Pete Markowsky <peterm[at] ccs.neu.edu>
Unix Security Technologies Pete Markowsky What is this about? The goal of this CPU/SWS are: Introduce you to classic vulnerabilities Get you to understand security advisories Make
Operating Systems 4 th Class
Operating Systems 4 th Class Lecture 1 Operating Systems Operating systems are essential part of any computer system. Therefore, a course in operating systems is an essential part of any computer science
Operating Systems. Privileged Instructions
Operating Systems Operating systems manage processes and resources Processes are executing instances of programs may be the same or different programs process 1 code data process 2 code data process 3
Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture
Last Class: OS and Computer Architecture System bus Network card CPU, memory, I/O devices, network card, system bus Lecture 3, page 1 Last Class: OS and Computer Architecture OS Service Protection Interrupts
How ToWrite a UNIX Daemon
How ToWrite a UNIX Daemon Dave Lennert Hewlett-Packard Company ABSTRACT On UNIX systems users can easily write daemon programs that perform repetitive tasks in an unnoticed way. However, because daemon
RTOS Debugger for ecos
RTOS Debugger for ecos TRACE32 Online Help TRACE32 Directory TRACE32 Index TRACE32 Documents... RTOS Debugger... RTOS Debugger for ecos... 1 Overview... 2 Brief Overview of Documents for New Users... 3
b. A program calls malloc to request more memory from the operating system. i.what system call would malloc use to request more memory of the OS?
CS 4410 Operating Systems Prelim II, Fall 2013 Profs. Sirer and van Renesse Name: NETID: This is a closed book examination. It is 10 pages long. You have 120 minutes. No electronic devices of any kind
Chapter 3 Operating-System Structures
Contents 1. Introduction 2. Computer-System Structures 3. Operating-System Structures 4. Processes 5. Threads 6. CPU Scheduling 7. Process Synchronization 8. Deadlocks 9. Memory Management 10. Virtual
Jorix kernel: real-time scheduling
Jorix kernel: real-time scheduling Joris Huizer Kwie Min Wong May 16, 2007 1 Introduction As a specialized part of the kernel, we implemented two real-time scheduling algorithms: RM (rate monotonic) and
CS161: Operating Systems
CS161: Operating Systems Matt Welsh [email protected] Lecture 2: OS Structure and System Calls February 6, 2007 1 Lecture Overview Protection Boundaries and Privilege Levels What makes the kernel different
System Calls and Standard I/O
System Calls and Standard I/O Professor Jennifer Rexford http://www.cs.princeton.edu/~jrex 1 Goals of Today s Class System calls o How a user process contacts the Operating System o For advanced services
Debugging with TotalView
Tim Cramer 17.03.2015 IT Center der RWTH Aachen University Why to use a Debugger? If your program goes haywire, you may... ( wand (... buy a magic... read the source code again and again and...... enrich
Introduction to Operating Systems. Perspective of the Computer. System Software. Indiana University Chen Yu
Introduction to Operating Systems Indiana University Chen Yu Perspective of the Computer System Software A general piece of software with common functionalities that support many applications. Example:
Libmonitor: A Tool for First-Party Monitoring
Libmonitor: A Tool for First-Party Monitoring Mark W. Krentel Dept. of Computer Science Rice University 6100 Main St., Houston, TX 77005 [email protected] ABSTRACT Libmonitor is a library that provides
Review from last time. CS 537 Lecture 3 OS Structure. OS structure. What you should learn from this lecture
Review from last time CS 537 Lecture 3 OS Structure What HW structures are used by the OS? What is a system call? Michael Swift Remzi Arpaci-Dussea, Michael Swift 1 Remzi Arpaci-Dussea, Michael Swift 2
Real Time Programming: Concepts
Real Time Programming: Concepts Radek Pelánek Plan at first we will study basic concepts related to real time programming then we will have a look at specific programming languages and study how they realize
Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine
7 Objectives After completing this lab you will: know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine Introduction Branches and jumps provide ways to change
Linux/UNIX System Programming. POSIX Shared Memory. Michael Kerrisk, man7.org c 2015. February 2015
Linux/UNIX System Programming POSIX Shared Memory Michael Kerrisk, man7.org c 2015 February 2015 Outline 22 POSIX Shared Memory 22-1 22.1 Overview 22-3 22.2 Creating and opening shared memory objects 22-10
REAL TIME OPERATING SYSTEM PROGRAMMING-II: II: Windows CE, OSEK and Real time Linux. Lesson-12: Real Time Linux
REAL TIME OPERATING SYSTEM PROGRAMMING-II: II: Windows CE, OSEK and Real time Linux Lesson-12: Real Time Linux 1 1. Real Time Linux 2 Linux 2.6.x Linux is after Linus Torvalds, father of the Linux operating
COS 318: Operating Systems. I/O Device and Drivers. Input and Output. Definitions and General Method. Revisit Hardware
COS 318: Operating Systems I/O and Drivers Input and Output A computer s job is to process data Computation (, cache, and memory) Move data into and out of a system (between I/O devices and memory) Challenges
CSC 2405: Computer Systems II
CSC 2405: Computer Systems II Spring 2013 (TR 8:30-9:45 in G86) Mirela Damian http://www.csc.villanova.edu/~mdamian/csc2405/ Introductions Mirela Damian Room 167A in the Mendel Science Building [email protected]
Audit Trail Administration
Audit Trail Administration 0890431-030 August 2003 Copyright 2003 by Concurrent Computer Corporation. All rights reserved. This publication or any part thereof is intended for use with Concurrent Computer
Chapter 11 I/O Management and Disk Scheduling
Operating Systems: Internals and Design Principles, 6/E William Stallings Chapter 11 I/O Management and Disk Scheduling Dave Bremer Otago Polytechnic, NZ 2008, Prentice Hall I/O Devices Roadmap Organization
Operating Systems. Design and Implementation. Andrew S. Tanenbaum Melanie Rieback Arno Bakker. Vrije Universiteit Amsterdam
Operating Systems Design and Implementation Andrew S. Tanenbaum Melanie Rieback Arno Bakker Vrije Universiteit Amsterdam Operating Systems - Winter 2012 Outline Introduction What is an OS? Concepts Processes
Outline. Operating Systems Design and Implementation. Chap 1 - Overview. What is an OS? 28/10/2014. Introduction
Operating Systems Design and Implementation Andrew S. Tanenbaum Melanie Rieback Arno Bakker Outline Introduction What is an OS? Concepts Processes and Threads Memory Management File Systems Vrije Universiteit
Intel P6 Systemprogrammering 2007 Föreläsning 5 P6/Linux Memory System
Intel P6 Systemprogrammering 07 Föreläsning 5 P6/Linux ory System Topics P6 address translation Linux memory management Linux page fault handling memory mapping Internal Designation for Successor to Pentium
System Resources. To keep your system in optimum shape, you need to be CHAPTER 16. System-Monitoring Tools IN THIS CHAPTER. Console-Based Monitoring
CHAPTER 16 IN THIS CHAPTER. System-Monitoring Tools. Reference System-Monitoring Tools To keep your system in optimum shape, you need to be able to monitor it closely. Such monitoring is imperative in
Operating Systems and Networks
recap Operating Systems and Networks How OS manages multiple tasks Virtual memory Brief Linux demo Lecture 04: Introduction to OS-part 3 Behzad Bordbar 47 48 Contents Dual mode API to wrap system calls
Operating System Structure
Operating System Structure Lecture 3 Disclaimer: some slides are adopted from the book authors slides with permission Recap Computer architecture CPU, memory, disk, I/O devices Memory hierarchy Architectural
Shared Address Space Computing: Programming
Shared Address Space Computing: Programming Alistair Rendell See Chapter 6 or Lin and Synder, Chapter 7 of Grama, Gupta, Karypis and Kumar, and Chapter 8 of Wilkinson and Allen Fork/Join Programming Model
I/O Device and Drivers
COS 318: Operating Systems I/O Device and Drivers Prof. Margaret Martonosi Computer Science Department Princeton University http://www.cs.princeton.edu/courses/archive/fall11/cos318/ Announcements Project
Monitoring PostgreSQL database with Verax NMS
Monitoring PostgreSQL database with Verax NMS Table of contents Abstract... 3 1. Adding PostgreSQL database to device inventory... 4 2. Adding sensors for PostgreSQL database... 7 3. Adding performance
Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY. 6.828 Operating System Engineering: Fall 2005
Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.828 Operating System Engineering: Fall 2005 Quiz II Solutions Average 84, median 83, standard deviation
Process Description and Control. 2004-2008 william stallings, maurizio pizzonia - sistemi operativi
Process Description and Control 1 Process A program in execution (running) on a computer The entity that can be assigned to and executed on a processor A unit of activity characterized by a at least one
ARUNNING INSTANCE OF A PROGRAM IS CALLED A PROCESS. If you have two
3 Processes ARUNNING INSTANCE OF A PROGRAM IS CALLED A PROCESS. If you have two terminal windows showing on your screen, then you are probably running the same terminal program twice you have two terminal
System Security Fundamentals
System Security Fundamentals Alessandro Barenghi Dipartimento di Elettronica, Informazione e Bioingegneria Politecnico di Milano alessandro.barenghi - at - polimi.it April 28, 2015 Lesson contents Overview
MatrixSSL Porting Guide
MatrixSSL Porting Guide Electronic versions are uncontrolled unless directly accessed from the QA Document Control system. Printed version are uncontrolled except when stamped with VALID COPY in red. External
Page 1 of 5. IS 335: Information Technology in Business Lecture Outline Operating Systems
Lecture Outline Operating Systems Objectives Describe the functions and layers of an operating system List the resources allocated by the operating system and describe the allocation process Explain how
The System Monitor Handbook. Chris Schlaeger John Tapsell Chris Schlaeger Tobias Koenig
Chris Schlaeger John Tapsell Chris Schlaeger Tobias Koenig 2 Contents 1 Introduction 6 2 Using System Monitor 7 2.1 Getting started........................................ 7 2.2 Process Table.........................................
Operating System Structures
COP 4610: Introduction to Operating Systems (Spring 2015) Operating System Structures Zhi Wang Florida State University Content Operating system services User interface System calls System programs Operating
POSIX. RTOSes Part I. POSIX Versions. POSIX Versions (2)
RTOSes Part I Christopher Kenna September 24, 2010 POSIX Portable Operating System for UnIX Application portability at source-code level POSIX Family formally known as IEEE 1003 Originally 17 separate
Replication on Virtual Machines
Replication on Virtual Machines Siggi Cherem CS 717 November 23rd, 2004 Outline 1 Introduction The Java Virtual Machine 2 Napper, Alvisi, Vin - DSN 2003 Introduction JVM as state machine Addressing non-determinism
Lecture 17. Process Management. Process Management. Process Management. Inter-Process Communication. Inter-Process Communication
Process Management Lecture 17 Review February 25, 2005 Program? Process? Thread? Disadvantages, advantages of threads? How do you identify processes? How do you fork a child process, the child process
Lecture 24 Systems Programming in C
Lecture 24 Systems Programming in C A process is a currently executing instance of a program. All programs by default execute in the user mode. A C program can invoke UNIX system calls directly. A system
Real-Time Systems Prof. Dr. Rajib Mall Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur
Real-Time Systems Prof. Dr. Rajib Mall Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture No. # 26 Real - Time POSIX. (Contd.) Ok Good morning, so let us get
10.04.2008. Thomas Fahrig Senior Developer Hypervisor Team. Hypervisor Architecture Terminology Goals Basics Details
Thomas Fahrig Senior Developer Hypervisor Team Hypervisor Architecture Terminology Goals Basics Details Scheduling Interval External Interrupt Handling Reserves, Weights and Caps Context Switch Waiting
Operating Systems, 6 th ed. Test Bank Chapter 7
True / False Questions: Chapter 7 Memory Management 1. T / F In a multiprogramming system, main memory is divided into multiple sections: one for the operating system (resident monitor, kernel) and one
Linux Driver Devices. Why, When, Which, How?
Bertrand Mermet Sylvain Ract Linux Driver Devices. Why, When, Which, How? Since its creation in the early 1990 s Linux has been installed on millions of computers or embedded systems. These systems may
EMC RepliStor for Microsoft Windows ERROR MESSAGE AND CODE GUIDE P/N 300-002-826 REV A02
EMC RepliStor for Microsoft Windows ERROR MESSAGE AND CODE GUIDE P/N 300-002-826 REV A02 EMC Corporation Corporate Headquarters: Hopkinton, MA 01748-9103 1-508-435-1000 www.emc.com Copyright 2003-2005
µtasker Document FTP Client
Embedding it better... µtasker Document FTP Client utaskerftp_client.doc/1.01 Copyright 2012 M.J.Butcher Consulting Table of Contents 1. Introduction...3 2. FTP Log-In...4 3. FTP Operation Modes...4 4.
CHAPTER 17: File Management
CHAPTER 17: File Management The Architecture of Computer Hardware, Systems Software & Networking: An Information Technology Approach 4th Edition, Irv Englander John Wiley and Sons 2010 PowerPoint slides
CSC230 Getting Starting in C. Tyler Bletsch
CSC230 Getting Starting in C Tyler Bletsch What is C? The language of UNIX Procedural language (no classes) Low-level access to memory Easy to map to machine language Not much run-time stuff needed Surprisingly
Project No. 2: Process Scheduling in Linux Submission due: April 28, 2014, 11:59pm
Project No. 2: Process Scheduling in Linux Submission due: April 28, 2014, 11:59pm PURPOSE Getting familiar with the Linux kernel source code. Understanding process scheduling and how different parameters
Virtual Private Systems for FreeBSD
Virtual Private Systems for FreeBSD Klaus P. Ohrhallinger 06. June 2010 Abstract Virtual Private Systems for FreeBSD (VPS) is a novel virtualization implementation which is based on the operating system
System Calls Related to File Manipulation
KING FAHD UNIVERSITY OF PETROLEUM AND MINERALS Information and Computer Science Department ICS 431 Operating Systems Lab # 12 System Calls Related to File Manipulation Objective: In this lab we will be
OS Thread Monitoring for DB2 Server
1 OS Thread Monitoring for DB2 Server Minneapolis March 1st, 2011 Mathias Hoffmann ITGAIN GmbH [email protected] 2 Mathias Hoffmann Background Senior DB2 Consultant Product Manager for SPEEDGAIN
Angels (OpenSSL) and D(a)emons. Athula Balachandran Wolfgang Richter
Angels (OpenSSL) and D(a)emons Athula Balachandran Wolfgang Richter PJ1 Final Submission SSL server-side implementation CGI Daemonize SSL Stuff you already know! Standard behind secure communication on
Lesson Objectives. To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization
Lesson Objectives To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization AE3B33OSD Lesson 1 / Page 2 What is an Operating System? A
Helping you avoid stack overflow crashes!
Helping you avoid stack overflow crashes! One of the toughest (and unfortunately common) problems in embedded systems is stack overflows and the collateral corruption that it can cause. As a result, we
Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6
Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6 Winter Term 2008 / 2009 Jun.-Prof. Dr. André Brinkmann [email protected] Universität Paderborn PC² Agenda Multiprocessor and
Shared Memory Segments and POSIX Semaphores 1
Shared Memory Segments and POSIX Semaphores 1 Alex Delis delis -at+ pitt.edu October 2012 1 Acknowledgements to Prof. T. Stamatopoulos, M. Avidor, Prof. A. Deligiannakis, S. Evangelatos, Dr. V. Kanitkar
OPERATING SYSTEM SERVICES
OPERATING SYSTEM SERVICES USER INTERFACE Command line interface(cli):uses text commands and a method for entering them Batch interface(bi):commands and directives to control those commands are entered
Operating System Components and Services
Operating System Components and Services Tom Kelliher, CS 311 Feb. 6, 2012 Announcements: From last time: 1. System architecture issues. 2. I/O programming. 3. Memory hierarchy. 4. Hardware protection.
Operating Systems for Parallel Processing Assistent Lecturer Alecu Felician Economic Informatics Department Academy of Economic Studies Bucharest
Operating Systems for Parallel Processing Assistent Lecturer Alecu Felician Economic Informatics Department Academy of Economic Studies Bucharest 1. Introduction Few years ago, parallel computers could
Java Troubleshooting and Performance
Java Troubleshooting and Performance Margus Pala Java Fundamentals 08.12.2014 Agenda Debugger Thread dumps Memory dumps Crash dumps Tools/profilers Rules of (performance) optimization 1. Don't optimize
Outline. Review. Inter process communication Signals Fork Pipes FIFO. Spotlights
Outline Review Inter process communication Signals Fork Pipes FIFO Spotlights 1 6.087 Lecture 14 January 29, 2010 Review Inter process communication Signals Fork Pipes FIFO Spotlights 2 Review: multithreading
Operating System Components
Lecture Overview Operating system software introduction OS components OS services OS structure Operating Systems - April 24, 2001 Operating System Components Process management Memory management Secondary
COS 318: Operating Systems. File Layout and Directories. Topics. File System Components. Steps to Open A File
Topics COS 318: Operating Systems File Layout and Directories File system structure Disk allocation and i-nodes Directory and link implementations Physical layout for performance 2 File System Components
1 File Management. 1.1 Naming. COMP 242 Class Notes Section 6: File Management
COMP 242 Class Notes Section 6: File Management 1 File Management We shall now examine how an operating system provides file management. We shall define a file to be a collection of permanent data with
Laboratory Report. An Appendix to SELinux & grsecurity: A Side-by-Side Comparison of Mandatory Access Control & Access Control List Implementations
Laboratory Report An Appendix to SELinux & grsecurity: A Side-by-Side Comparison of Mandatory Access Control & Access Control List Implementations 1. Hardware Configuration We configured our testbed on
A Comparative Study on Vega-HTTP & Popular Open-source Web-servers
A Comparative Study on Vega-HTTP & Popular Open-source Web-servers Happiest People. Happiest Customers Contents Abstract... 3 Introduction... 3 Performance Comparison... 4 Architecture... 5 Diagram...
Outline: Operating Systems
Outline: Operating Systems What is an OS OS Functions Multitasking Virtual Memory File Systems Window systems PC Operating System Wars: Windows vs. Linux 1 Operating System provides a way to boot (start)
Unix System Calls. Dept. CSIE 2006.12.25
Unix System Calls Gwan-Hwan Hwang Dept. CSIE National Taiwan Normal University 2006.12.25 UNIX System Overview UNIX Architecture Login Name Shells Files and Directories File System Filename Pathname Working
Matisse Server Administration Guide
Matisse Server Administration Guide May 2014 MATISSE Server Administration Guide Copyright 2013 Matisse Software Inc. All Rights Reserved. This manual and the software described in it are copyrighted.
