Processes, Protection and the Kernel: Mode, Space, and Context
|
|
|
- Easter Warner
- 9 years ago
- Views:
Transcription
1 Processes, Protection and the Kernel: Mode, Space, and Context
2 Processes and the Kernel processes in private virtual address spaces data data The kernel sets up process execution contexts to virtualize the machine. system call traps...and upcalls (e.g., signals) shared kernel code and data in shared address space CPU and devices force entry to the kernel to handle exceptional events. Threads or processes enter the kernel for services.
3 Objectives The nature of the classical kernel, its protection mechanisms, and architectural support for protected kernels. Mode, space, and context. Control transfer from user code into the kernel. System calls (traps) and user program events (faults). Access control: handles, IDs, and Access Control Lists. Control transfer from the kernel to user code. Signals, APCs, syscall return. Kernel synchronization. Process structure and process birth/death, process states. Fork/exec/exit/join/wait and process trees.
4 The Kernel Today, all real operating systems have protected kernels. The kernel resides in a well-known file: the machine automatically loads it into memory (boots) on power-on/reset. Our kernel is called the executive in some systems (e.g., MS). The kernel is (mostly) a library of service procedures shared by all user programs, but the kernel is protected: User code cannot access internal kernel data structures directly, and it can invoke the the kernel only at well-defined entry points (system calls). Kernel code is like user code, but the kernel is privileged: The kernel has direct access to all hardware functions, and defines the entry points of handlers for interrupts and exceptions (traps and faults).
5 Kernel Mode CPU mode (a field in some status register) indicates whether the CPU is running in a user program or in the protected kernel. Some instructions or data accesses are only legal when the CPU is executing in kernel mode. CPU mode R0 Rn PC x registers 0 x OS code OS data Program A data Data Program B Data code library 2 n main memory physical address space
6 Thread/Process States and Transitions running (user) interrupt, exception, return interrupt, exception Sleep running (kernel) Run Yield blocked Wakeup ready
7 CPU Events: Interrupts and Exceptions An interrupt is caused by an external event. device requests attention, timer expires, etc. An exception is caused by an executing instruction. CPU requires software intervention to handle a fault or trap. unplanned deliberate sync fault syscall trap async interrupt AST AST: Asynchronous System Trap Also called a software interrupt or an Asynchronous or Deferred Procedure Call (APC or DPC) control flow Note: different cultures may use some of these terms (e.g., trap, fault, exception, event, interrupt) slightly differently. exception.cc event handler (e.g., ISR: Interrupt Service Routine)
8 Protecting Entry to the Kernel Protected events and kernel mode are the architectural foundations of kernel-based OS (Unix, NT+, etc). The machine defines a small set of exceptional event types. The machine defines what conditions raise each event. The kernel installs handlers for each event at boot time. e.g., a table in kernel memory read by the machine The machine transitions to kernel mode only on an exceptional event. The kernel defines the event handlers. Therefore the kernel chooses what code will execute in kernel mode, and when. event/return user kernel event/return
9 Handling Events, Part I: The Big Picture 1. To deliver the event, the machine saves relevant state in temporary storage, then transfers control to the kernel. Set kernel mode and set PC := handler. 2. Kernel handler examines registers and saved machine state. What happened? What was the machine doing when it happened? How should the kernel respond? 3. Kernel responds to the condition. Execute kernel service, device control code, fault handlers, etc., modify machine state as needed. 4. Kernel restores saved context (registers) and resumes activity. 5. Specific events and mechanisms for saving, examining, or restoring context are machine-dependent.
10 The Role of Events Once the system is booted, every entry to the kernel occurs as a result of an event. In some sense, the whole kernel is a big event handler. Event handlers are kernel-defined and execute in kernel mode. Events do not change the identity of the executing thread/process. Context: thread/process context, or interrupt context. Loosely, whose stack are you running on. For purposes of this discussion, suppose one thread per process. Events do not change the current space!
11 The Virtual Address Space 0 text data BSS user stack args/env 0x0 sbrk() jsr A typical process VAS space includes: user regions in the lower half V->P mappings specific to each process accessible to user or kernel code 2 n-1 2 n -1 kernel text and kernel data 0xffffffff kernel regions in upper half shared by all processes accessible only to kernel code Nachos: process virtual address space includes only user portions. A VAS for a private address space system (e.g., Unix) executing on a typical 32-bit architecture.
12 Example: Process and Kernel Address Spaces 0 0x0 n-bit virtual address space data data 32-bit virtual address space 2 n-1-1 0x7FFFFFFF 2 n-1 0x n -1 0xFFFFFFFF
13 Introduction to Virtual Addressing User processes address memory through virtual addresses. virtual memory (big) text data physical memory (small) The kernel controls the virtual-physical translations in effect for each space. The kernel and the machine collude to translate virtual addresses to physical addresses. BSS user stack args/env kernel The machine does not allow a user process to access memory unless the kernel says it s OK. virtual-to-physical translations The specific mechanisms for implementing virtual address translation are machine-dependent: we will cover them later.
14 System Call Traps User code invokes kernel services by initiating system call traps. Programs in C, C++, etc. invoke system calls by linking to a standard library of procedures written in assembly language. The library defines a stub or wrapper routine for each syscall. Stub executes a special trap instruction (e.g., chmk or callsys). Syscall arguments/results passed in registers or user stack. read() in Unix libc.a library (executes in user mode): Alpha CPU architecture #define SYSCALL_READ 27 # number for a read system call move arg0 argn, a0 an # syscall args in registers A0..AN move SYSCALL_READ, v0 # syscall dispatch code in V0 callsys # kernel trap move r1, _errno # errno = return status return
15 Bullet-Proofing the Kernel System calls must be safe to protect the kernel from buggy or malicious user programs. 1. System calls enter the kernel at a well-known safe point. Enter at the kernel trap handler; control transfers to the middle of the kernel are not permitted. 2. The kernel validates all system call arguments before use. Kernel may reject a request if it is meaningless or if the user process has inadequate privilege for the requested operation. 3. All memory used by the system call handler is in kernel space, so it is protected from interference by user code. What stack does the system call execute on?
16 Kernel Stacks and Trap/Fault Handling Processes execute user code on a user stack in the user portion of the process virtual address space. data stack stack System calls and faults run in kernel mode on the process kernel stack. Each process has a second kernel stack in kernel space (the kernel portion of the address space). stack syscall dispatch table stack System calls run in the process space, so copyin and copyout can access user memory. The syscall trap handler makes an indirect call through the system call dispatch table to the handler for the specific system call.
17 Safe Handling of Syscall Args/Results 1. Decode and validate by-value arguments. Process (stub) leaves arguments in registers or on the stack. 2. Validate by-reference (pointer) IN arguments. Validate user pointers and copy data into kernel memory with a special safe copy routine, e.g., copyin(). 3. Validate by-reference (pointer) OUT arguments. Copy OUT results into user memory with special safe copy routine, e.g., copyout(). 4. Set up registers with return value(s); return to user space. Stub may check to see if syscall failed, possibly raising a user program exception or storing the result in a variable.
18 Kernel Object Handles Instances of kernel abstractions may be viewed as objects named by protected handles held by processes. Handles are obtained by create/open calls, subject to security policies that grant specific rights for each handle. Any process with a handle for an object may operate on the object using operations (system calls). Specific operations are defined by the object s type. The handle is an integer index to a kernel table. Microsoft NT object handles Unix file descriptors Nachos FileID and SpaceID user space object handles kernel file port etc.
19 Example: Mechanics of an Alpha Syscall Trap 1. Machine saves return address and switches to kernel stack. save user SP, global pointer(gp), PC on kernel stack set kernel mode and transfer to a syscall trap handler (entsys) 2. Trap handler saves software state, and dispatches. save some/all registers/arguments on process kernel stack vector to syscall routine through sysent[v0: dispatchcode] 3. Trap handler returns to user mode. when syscall routine returns, restore user register state execute privileged return-from-syscall instruction (retsys) machine restores SP, GP, PC and sets user mode emerges at user instruction following the callsys
20 Questions About System Call Handling 1. Why do we need special copyin and copyout routines? validate user addresses before using them 2. What would happen if the kernel did not save all registers? 3. Where should per-process kernel global variables reside? syscall arguments (consider size) and error code 4. What if the kernel executes a callsys instruction? What if user code executes a retsys instruction? 5. How to pass references to kernel objects as arguments or results to/from system calls? pointers? No: use integer object handles or descriptors (also sometimes called capabilities).
21 Flashback: Virtual Addressing User processes address memory through virtual addresses. virtual memory (big) text data physical memory (small) The kernel controls the virtual-physical translations in effect for each space. The kernel and the machine collude to translate virtual addresses to physical addresses. BSS user stack args/env kernel The machine does not allow a user process to access memory unless the kernel says it s OK. virtual-to-physical translations The specific mechanisms for implementing virtual address translation are machine-dependent: we will cover them later.
22 A Simple Page Table process page table PFN 0 PFN 1 Each process/vas has its own page table. Virtual addresses are translated relative to the current page table. PFN i page #i PFN i + offset offset user virtual address physical memory page frames In this example, each VPN j maps to PFN j, but in practice any physical frame may be used for any virtual page. The page tables are themselves stored in memory; a protected register holds a pointer to the current page table.
23 Virtual Address Translation Example: typical 32-bit architecture with 8KB pages. 00 virtual address VPN offset Virtual address translation maps a virtual page number (VPN) to a physical page frame number (PFN): the rest is easy. Deliver exception to OS if translation is not valid and accessible in requested mode. physical address{ address translation PFN + offset
24 Faults Faults are similar to system calls in some respects: Faults occur as a result of a process executing an instruction. Fault handlers execute on the process kernel stack; the fault handler may block (sleep) in the kernel. The completed fault handler may return to the faulted context. But faults are different from syscall traps in other respects: Syscalls are deliberate, but faults are accidents. divide-by-zero, dereference invalid pointer, memory page fault Not every execution of the faulting instruction results in a fault. may depend on memory state or register contents
25 Options for Handling a Fault (1) 1. Some faults are handled by patching things up and returning to the faulted context. Example: the kernel may resolve an address fault (virtual memory fault) by installing a new virtual-physical translation. The fault handler may adjust the saved PC to re-execute the faulting instruction after returning from the fault. 2. Some faults are handled by notifying the process that the fault occurred, so it may recover in its own way. Fault handler munges the saved user context (PC, SP) to transfer control to a registered user-mode handler on return from the fault. Example: Unix signals or Microsoft NT user-mode Asynchronous Procedure Calls (APCs).
26 Options for Handling a Fault (2) 3. The kernel may handle unrecoverable faults by killing the user process. Program fault with no registered user-mode handler? Destroy the process, release its resources, maybe write the memory image to a file, and find another ready process/thread to run. In Unix this is the default action for many signals (e.g., SEGV). 4. How to handle faults generated by the kernel itself? Kernel follows a bogus pointer? Divides by zero? Executes an instruction that is undefined or reserved to user mode? These are generally fatal operating system errors resulting in a system crash, e.g., panic()!
27 Thought Questions About Faults 1. How do you suppose ASSERT and panic are implemented? 2. Unix systems allow you to run a program under a debugger. How do you suppose that works? If the program crashes, the debugger regains control and allows you to examine/modify its memory and register values! 3. Some operating systems allow remote debugging. A remote machine may examine/modify a crashed system over the network. How? 4. How can a user-mode fault handler recover from a fault? How does it return to the faulted context? 5. How can a debugger restart a program that has stopped, e.g., due to a fault? How are breakpoints implemented? 6. What stack do signal handlers run on?
28 Architectural Foundations of OS Kernels One or more privileged execution modes (e.g., kernel mode) protected device control registers privileged instructions to control basic machine functions System call trap instruction and protected fault handling User processes safely enter the kernel to access shared OS services. Virtual memory mapping OS controls virtual-physical translations for each address space. Device interrupts to notify the kernel of I/O completion etc. Includes timer hardware and clock interrupts to periodically return control to the kernel as user code executes. Atomic instructions for coordination on multiprocessors
29 A Few More Points about Events The machine may actually be implemented by a combination of hardware and special pre-installed software (firmware). PAL (Privileged Architecture Library) on Alpha hides hardware details from even the OS kernel some instructions are really short PAL routines some special machine registers are really in PAL scratch memory, not CPU registers Events illustrate hardware/software tradeoffs: how much of the context should be saved on an event or switch, and by whom (hardware, PAL, or OS) goal: simple hardware and good performance in common cases
30 Mode, Space, and Context At any time, the state of each processor is defined by: 1. mode: given by the mode bit Is the CPU executing in the protected kernel or a user program? 2. space: defined by V->P translations currently in effect What address space is the CPU running in? Once the system is booted, it always runs in some virtual address space. 3. context: given by register state and execution stream Is the CPU executing a thread/process, or an interrupt handler? Where is the stack? These are important because the mode/space/context determines the meaning and validity of key operations.
31 Common Mode/Space/Context Combinations 1. User code executes in a process/thread context in a process address space, in user mode. Can address only user code/data defined for the process, with no access to privileged instructions. 2. System services execute in a process/thread context in a process address space, in kernel mode. Can address kernel memory or user process code/data, with access to protected operations: may sleep in the kernel. 3. Interrupts execute in a system interrupt context in the address space of the interrupted process, in kernel mode. Can access kernel memory and use protected operations. no sleeping!
32 Kernel Concurrency Control 101 Processes/threads running in kernel mode share access to system data structures in the kernel address space. Sleep/wakeup (or equivalent) are the basis for: coordination, e.g., join (exit/wait), timed waits (pause), bounded buffer (pipe read/write), message send/receive synchronization, e.g., long-term mutual exclusion for atomic read*/write* syscalls user kernel interrupt or exception Sleep/wakeup is sufficient for concurrency control among kernel-mode threads on uniprocessors: problems arise from interrupts and multiprocessors.
33 Dangerous Transitions Interrupt handlers may share data with syscall code, or with other handlers. Kernel-mode threads must restore data to a consistent state before blocking. interrupt kernel interrupt sleep run user trap/fault run kernel suspend/run (suspend) run preempt (ready) Involuntary context switches of threads in user mode have no effect on kernel data. blocked wakeup ready The shared data states observed by an awakening thread may have changed while sleeping. Threads in kernel mode are non-preemptible as a policy in most kernels.
34 The Problem of Interrupts Interrupts can cause races if the handler (ISR) shares data with the interrupted code. e.g., wakeup call from an ISR may corrupt the sleep queue. Interrupts may be nested. ISRs may race with each other. kernel code (e.g., syscall) high-priority ISR low-priority handler (ISR)
35 Interrupt Priority Traditional Unix kernels illustrate the basic approach to avoiding interrupt races. Rank interrupt types in N priority classes. When an ISR at priority p runs, CPU blocks interrupts of priority p or lower. How big must the interrupt stack be? Kernel software can query/raise/lower the CPU interrupt priority level (IPL). Avoid races with an ISR of higher priority by raising CPU IPL to that priority. Unix spl*/splx primitives (may need software support on some architectures). spl0 splnet splbio splimp clock splx(s) low high int s; s = splhigh(); /* touch sleep queues */ splx(s);
36 Multiprocessor Kernels On a shared memory multiprocessor, non-preemptible kernel code and spl*() are no longer sufficient to prevent races. Option 1, asymmetric multiprocessing: limit all handling of traps and interrupts to a single processor. slow and boring Option 2, symmetric multiprocessing ( SMP ): supplement existing synchronization primitives. any CPU may execute kernel code synchronize with spin-waiting requires atomic instructions use spinlocks but still must disable interrupts M P P P P
37 Example: Unix Sleep sleep (void* event, int sleep_priority) { struct proc *p = curproc; int s; Optional } s = splhigh(); /* disable all interrupts */ p->p_wchan = event; /* what are we waiting for */ p->p_priority -> priority; /* wakeup scheduler priority */ p->p_stat = SSLEEP; /* transition curproc to sleep state */ INSERTQ(&slpque[HASH(event)], p); /* fiddle sleep queue */ splx(s); /* enable interrupts */ mi_switch(); /* context switch */ /* we re back... */
38 Implementing Sleep on a Multiprocessor sleep (void* event, int sleep_priority) { struct proc *p = curproc; int s; Optional What if another CPU takes an interrupt and calls wakeup? } s = splhigh(); /* disable all interrupts */ p->p_wchan = event; /* what are we waiting for */ p->p_priority -> priority; /* wakeup scheduler priority */ p->p_stat = SSLEEP; /* transition curproc to sleep state */ INSERTQ(&slpque[HASH(event)], p); /* fiddle sleep queue */ splx(s); /* enable interrupts */ mi_switch(); /* context switch */ /* we re back... */ What if another CPU is handling a syscall and calls sleep or wakeup? What if another CPU tries to wakeup curproc before it has completed mi_switch?
39 Using Spinlocks in Sleep: : First Try sleep (void* event, int sleep_priority) { struct proc *p = curproc; int s; Grab spinlock to prevent another CPU from racing with us. Optional } lock spinlock; p->p_wchan = event; /* what are we waiting for */ p->p_priority -> priority; /* wakeup scheduler priority */ p->p_stat = SSLEEP; /* transition curproc to sleep state */ INSERTQ(&slpque[HASH(event)], p); /* fiddle sleep queue */ unlock spinlock; mi_switch(); /* context switch */ /* we re back */ Wakeup (or any other related critical section code) will use the same spinlock, guaranteeing mutual exclusion.
40 Sleep with Spinlocks: : What Went Wrong sleep (void* event, int sleep_priority) { struct proc *p = curproc; int s; } Optional Potential deadlock: what if we take an interrupt on this processor, and call wakeup while the lock is held? lock spinlock; p->p_wchan = event; /* what are we waiting for */ p->p_priority -> priority; /* wakeup scheduler priority */ p->p_stat = SSLEEP; /* transition curproc to sleep state */ INSERTQ(&slpque[HASH(event)], p); /* fiddle sleep queue */ unlock spinlock; mi_switch(); /* context switch */ /* we re back */ Potential doubly scheduled thread: what if another CPU calls wakeup to wake us up before we re finished with mi_switch on this CPU?
41 Using Spinlocks in Sleep: : Second Try sleep (void* event, int sleep_priority) { struct proc *p = curproc; int s; s = splhigh(); lock spinlock; Grab spinlock and disable interrupts. Optional p->p_wchan = event; /* what are we waiting for */ p->p_priority -> priority; /* wakeup scheduler priority */ p->p_stat = SSLEEP; /* transition curproc to sleep state */ INSERTQ(&slpque[HASH(event)], p); /* fiddle sleep queue */ unlock spinlock; splx(s); } mi_switch(); /* context switch */ /* we re back */
42 Review: Threads vs. Processes 1. The process is a kernel abstraction for an independent executing program. includes at least one thread of control also includes a private address space (VAS) - VAS requires OS kernel support often the unit of resource ownership in kernel - e.g., memory, open files, CPU usage 2. Threads may share an address space. Threads have context just like vanilla processes. - thread context switch vs. process context switch Every thread must exist within some process VAS. Processes may be multithreaded with thread primitives supported by a library or the kernel. data data
43 Implementing Processes: Questions A process is an execution of a program within a private virtual address space (VAS). 1. What are the system calls to operate on processes? 2. How does the kernel maintain the state of a process? Processes are the basic unit of resource grouping. 3. How is the process virtual address space laid out? What is the relationship between the program and the process? 4. How does the kernel create a new process? How to allocate physical memory for processes? How to create/initialize the virtual address space?
44 Nachos Exec/Exit/Join Example Exec parent Join Exec child Exit SpaceID pid = Exec( myprogram, 0); Create a new process running the program myprogram. Note: in Unix this is two separate system calls: fork to create the process and exec to execute the program. int status = Join(pid); Called by the parent to wait for a child to exit, and reap its exit status. Note: child may have exited before parent calls Join! Exit(status); Exit with status, destroying process. Note: this is not the only way for a proess to exit!.
45 Mode Changes for Exec/Exit Syscall traps and returns are not always paired. Exec returns (to child) from a trap that never happened Exit system call trap never returns system may switch processes between trap and return In contrast, interrupts and returns are strictly paired. parent Exec call Exec return Join call Join return Exec enters the child by doctoring up a saved user context to return through. child Exec entry to user space Exit call transition from user to kernel mode (callsys) transition from kernel to user mode (retsys)
46 Process Internals virtual address space thread process descriptor The address space is represented by page table, a set of translations to physical memory allocated from a kernel memory manager. The kernel must initialize the process memory with the program image to run. + + stack Each process has a thread bound to the VAS. The thread has a saved user context as well as a system context. The kernel can manipulate the user context to start the thread in user mode wherever it wants. user ID process ID parent PID sibling links children resources Process state includes a file descriptor table, links to maintain the process tree, and a place to store the exit status.
47 The Birth of a Program myprogram.c int j; char* s = hello\n ; assembler myprogram.o data object file int p() { j = write(1, s, 6); return(j); } compiler.. p: store this store that push jsr _write ret etc. myprogram.s linker data program data data data libraries and other objects myprogram (executable file)
48 What s in an Object File or Executable? Header magic number indicates type of image. Section table an array of (offset, len, startva) program sections header text idata wdata program instructions p immutable data (constants) hello\n writable global/static data j, s Used by linker; may be removed after final link step and strip. symbol table j, s,p,sbuf int j = 327; char* s = hello\n ; char sbuf[512]; relocation records int p() { int k = 0; j = write(1, s, 6); return(j); }
49 The Program and the Process VAS Process text segment is initialized directly from program text section. sections Process data segment(s) are initialized from idata and wdata sections. Text and idata segments may be write-protected. header text idata wdata symbol table relocation records program text data BSS user stack args/env kernel process VAS Process stack and BSS (e.g., heap) segment(s) are zero-filled. BSS Block Started by Symbol (uninitialized global data) e.g., heap and sbuf go here. segments Process BSS segment may be expanded at runtime with a system call (e.g., Unix sbrk) called by the heap manager routines. Args/env strings copied in by kernel when the process is created.
50 Nachos: A Peek Under the Hood shell data cp data user space MIPS instructions executed by SPIM SPIM MIPS emulator fetch/execute examine/deposit ExceptionHandler() Machine::Run() Nachos kernel SaveState/RestoreState examine/deposit Machine object Rn SP PC registers memory page table process page tables
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
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
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
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
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]
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
Linux Scheduler. Linux Scheduler
or or Affinity Basic Interactive es 1 / 40 Reality... or or Affinity Basic Interactive es The Linux scheduler tries to be very efficient To do that, it uses some complex data structures Some of what it
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
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
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
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
How To Write A Windows Operating System (Windows) (For Linux) (Windows 2) (Programming) (Operating System) (Permanent) (Powerbook) (Unix) (Amd64) (Win2) (X
(Advanced Topics in) Operating Systems Winter Term 2009 / 2010 Jun.-Prof. Dr.-Ing. André Brinkmann [email protected] Universität Paderborn PC 1 Overview Overview of chapter 3: Case Studies 3.1 Windows Architecture.....3
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
Virtual vs Physical Addresses
Virtual vs Physical Addresses Physical addresses refer to hardware addresses of physical memory. Virtual addresses refer to the virtual store viewed by the process. virtual addresses might be the same
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
COS 318: Operating Systems
COS 318: Operating Systems OS Structures and System Calls Andy Bavier Computer Science Department Princeton University http://www.cs.princeton.edu/courses/archive/fall10/cos318/ Outline Protection mechanisms
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
Operating System Overview. Otto J. Anshus
Operating System Overview Otto J. Anshus A Typical Computer CPU... CPU Memory Chipset I/O bus ROM Keyboard Network A Typical Computer System CPU. CPU Memory Application(s) Operating System ROM OS Apps
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
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
Red Hat Linux Internals
Red Hat Linux Internals Learn how the Linux kernel functions and start developing modules. Red Hat Linux internals teaches you all the fundamental requirements necessary to understand and start developing
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
Overview of Operating Systems Instructor: Dr. Tongping Liu
Overview of Operating Systems Instructor: Dr. Tongping Liu Thank Dr. Dakai Zhu and Dr. Palden Lama for providing their slides. 1 Lecture Outline Operating System: what is it? Evolution of Computer Systems
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
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
CS414 SP 2007 Assignment 1
CS414 SP 2007 Assignment 1 Due Feb. 07 at 11:59pm Submit your assignment using CMS 1. Which of the following should NOT be allowed in user mode? Briefly explain. a) Disable all interrupts. b) Read the
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
Technical Properties. Mobile Operating Systems. Overview Concepts of Mobile. Functions Processes. Lecture 11. Memory Management.
Overview Concepts of Mobile Operating Systems Lecture 11 Concepts of Mobile Operating Systems Mobile Business I (WS 2007/08) Prof Dr Kai Rannenberg Chair of Mobile Business and Multilateral Security Johann
A Survey of Parallel Processing in Linux
A Survey of Parallel Processing in Linux Kojiro Akasaka Computer Science Department San Jose State University San Jose, CA 95192 408 924 1000 [email protected] ABSTRACT Any kernel with parallel processing
Operating Systems. Lecture 03. February 11, 2013
Operating Systems Lecture 03 February 11, 2013 Goals for Today Interrupts, traps and signals Hardware Protection System Calls Interrupts, Traps, and Signals The occurrence of an event is usually signaled
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
Deciding which process to run. (Deciding which thread to run) Deciding how long the chosen process can run
SFWR ENG 3BB4 Software Design 3 Concurrent System Design 2 SFWR ENG 3BB4 Software Design 3 Concurrent System Design 11.8 10 CPU Scheduling Chapter 11 CPU Scheduling Policies Deciding which process to run
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
First-class User Level Threads
First-class User Level Threads based on paper: First-Class User Level Threads by Marsh, Scott, LeBlanc, and Markatos research paper, not merely an implementation report User-level Threads Threads managed
Chapter 2: OS Overview
Chapter 2: OS Overview CmSc 335 Operating Systems 1. Operating system objectives and functions Operating systems control and support the usage of computer systems. a. usage users of a computer system:
Glossary of Object Oriented Terms
Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction
CHAPTER 6 TASK MANAGEMENT
CHAPTER 6 TASK MANAGEMENT This chapter describes the IA-32 architecture s task management facilities. These facilities are only available when the processor is running in protected mode. 6.1. TASK MANAGEMENT
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
6.828 Operating System Engineering: Fall 2003. Quiz II Solutions THIS IS AN OPEN BOOK, OPEN NOTES QUIZ.
Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.828 Operating System Engineering: Fall 2003 Quiz II Solutions All problems are open-ended questions. In
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
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
Priority Based Implementation in Pintos
Priority Based Implementation in Pintos Deepa D 1, Nivas K S 2, Preethi V 3 1, 2, 3 Students M-Tech, Dept. of Information Technology, SNS College of Engg., Coimbatore. Abstract Pintos is a simple operating
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
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
Why Threads Are A Bad Idea (for most purposes)
Why Threads Are A Bad Idea (for most purposes) John Ousterhout Sun Microsystems Laboratories [email protected] http://www.sunlabs.com/~ouster Introduction Threads: Grew up in OS world (processes).
Automatic Logging of Operating System Effects to Guide Application-Level Architecture Simulation
Automatic Logging of Operating System Effects to Guide Application-Level Architecture Simulation Satish Narayanasamy, Cristiano Pereira, Harish Patil, Robert Cohn, and Brad Calder Computer Science and
umps software development
Laboratorio di Sistemi Operativi Anno Accademico 2006-2007 Software Development with umps Part 2 Mauro Morsiani Software development with umps architecture: Assembly language development is cumbersome:
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
CS5460: Operating Systems
CS5460: Operating Systems Lecture 13: Memory Management (Chapter 8) Where are we? Basic OS structure, HW/SW interface, interrupts, scheduling Concurrency Memory management Storage management Other topics
Scheduler Activations: Effective Kernel Support for the User-Level Management of Parallelism
[Recreated electronic version by Eric A. Brewer ([email protected]), Oct 20, 1998] Scheduler Activations: Effective Kernel Support for the User-Level Management of Parallelism THOMAS E. ANDERSON,
The Microsoft Windows Hypervisor High Level Architecture
The Microsoft Windows Hypervisor High Level Architecture September 21, 2007 Abstract The Microsoft Windows hypervisor brings new virtualization capabilities to the Windows Server operating system. Its
Lecture 25 Symbian OS
CS 423 Operating Systems Design Lecture 25 Symbian OS Klara Nahrstedt Fall 2011 Based on slides from Andrew S. Tanenbaum textbook and other web-material (see acknowledgements) cs423 Fall 2011 1 Overview
W4118 Operating Systems. Junfeng Yang
W4118 Operating Systems Junfeng Yang Outline Linux overview Interrupt in Linux System call in Linux What is Linux A modern, open-source OS, based on UNIX standards 1991, 0.1 MLOC, single developer Linus
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:
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
Linux scheduler history. We will be talking about the O(1) scheduler
CPU Scheduling Linux scheduler history We will be talking about the O(1) scheduler SMP Support in 2.4 and 2.6 versions 2.4 Kernel 2.6 Kernel CPU1 CPU2 CPU3 CPU1 CPU2 CPU3 Linux Scheduling 3 scheduling
RTEMS Porting Guide. On-Line Applications Research Corporation. Edition 4.10.99.0, for RTEMS 4.10.99.0. 17 July 2015
RTEMS Porting Guide Edition 4.10.99.0, for RTEMS 4.10.99.0 17 July 2015 On-Line Applications Research Corporation On-Line Applications Research Corporation TEXinfo 2013-02-01.11 COPYRIGHT c 1988-2015.
Computer-System Architecture
Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection General System Architecture 2.1 Computer-System Architecture 2.2 Computer-System
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:
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
W4118: segmentation and paging. Instructor: Junfeng Yang
W4118: segmentation and paging Instructor: Junfeng Yang Outline Memory management goals Segmentation Paging TLB 1 Uni- v.s. multi-programming Simple uniprogramming with a single segment per process Uniprogramming
Overview. CISC Developments. RISC Designs. CISC Designs. VAX: Addressing Modes. Digital VAX
Overview CISC Developments Over Twenty Years Classic CISC design: Digital VAX VAXÕs RISC successor: PRISM/Alpha IntelÕs ubiquitous 80x86 architecture Ð 8086 through the Pentium Pro (P6) RJS 2/3/97 Philosophy
CHAPTER 15: Operating Systems: An Overview
CHAPTER 15: Operating Systems: An Overview The Architecture of Computer Hardware, Systems Software & Networking: An Information Technology Approach 4th Edition, Irv Englander John Wiley and Sons 2010 PowerPoint
Embedded Systems. 6. Real-Time Operating Systems
Embedded Systems 6. Real-Time Operating Systems Lothar Thiele 6-1 Contents of Course 1. Embedded Systems Introduction 2. Software Introduction 7. System Components 10. Models 3. Real-Time Models 4. Periodic/Aperiodic
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
Mutual Exclusion using Monitors
Mutual Exclusion using Monitors Some programming languages, such as Concurrent Pascal, Modula-2 and Java provide mutual exclusion facilities called monitors. They are similar to modules in languages that
SSC - Concurrency and Multi-threading Java multithreading programming - Synchronisation (I)
SSC - Concurrency and Multi-threading Java multithreading programming - Synchronisation (I) Shan He School for Computational Science University of Birmingham Module 06-19321: SSC Outline Outline of Topics
Security Overview of the Integrity Virtual Machines Architecture
Security Overview of the Integrity Virtual Machines Architecture Introduction... 2 Integrity Virtual Machines Architecture... 2 Virtual Machine Host System... 2 Virtual Machine Control... 2 Scheduling
Windows8 Internals, Sixth Edition, Part 1
Microsoft Windows8 Internals, Sixth Edition, Part 1 Mark Russinovich David A. Solomon Alex lonescu Windows Internals, Sixth Edition, Part i Introduction xvii Chapter 1 Concepts and Tools 1 Windows Operating
A Look through the Android Stack
A Look through the Android Stack A Look through the Android Stack Free Electrons Maxime Ripard Free Electrons Embedded Linux Developers c Copyright 2004-2012, Free Electrons. Creative Commons BY-SA 3.0
Linux Kernel Networking. Raoul Rivas
Linux Kernel Networking Raoul Rivas Kernel vs Application Programming No memory protection Memory Protection We share memory with devices, scheduler Sometimes no preemption Can hog the CPU Segmentation
Topics. Producing Production Quality Software. Concurrent Environments. Why Use Concurrency? Models of concurrency Concurrency in Java
Topics Producing Production Quality Software Models of concurrency Concurrency in Java Lecture 12: Concurrent and Distributed Programming Prof. Arthur P. Goldberg Fall, 2005 2 Why Use Concurrency? Concurrent
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
Advanced Operating Systems (263 3800 00L)
Advanced Operating Systems (263 3800 00L) Timothy Roscoe Fall 2014 https://www.systems.ethz.ch/courses/fall2014/aos Systems Group Department of Computer Science ETH Zürich 1 Week 3: OS Architecture, Threads,
Operating System Tutorial
Operating System Tutorial OPERATING SYSTEM TUTORIAL Simply Easy Learning by tutorialspoint.com tutorialspoint.com i ABOUT THE TUTORIAL Operating System Tutorial An operating system (OS) is a collection
Cloud Computing. Up until now
Cloud Computing Lecture 11 Virtualization 2011-2012 Up until now Introduction. Definition of Cloud Computing Grid Computing Content Distribution Networks Map Reduce Cycle-Sharing 1 Process Virtual Machines
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
This tutorial will take you through step by step approach while learning Operating System concepts.
About the Tutorial An operating system (OS) is a collection of software that manages computer hardware resources and provides common services for computer programs. The operating system is a vital component
Keil C51 Cross Compiler
Keil C51 Cross Compiler ANSI C Compiler Generates fast compact code for the 8051 and it s derivatives Advantages of C over Assembler Do not need to know the microcontroller instruction set Register allocation
COS 318: Operating Systems. Virtual Memory and Address Translation
COS 318: Operating Systems Virtual Memory and Address Translation Today s Topics Midterm Results Virtual Memory Virtualization Protection Address Translation Base and bound Segmentation Paging Translation
FRONT FLYLEAF PAGE. This page has been intentionally left blank
FRONT FLYLEAF PAGE This page has been intentionally left blank Abstract The research performed under this publication will combine virtualization technology with current kernel debugging techniques to
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
CS0206 OPERATING SYSTEMS Prerequisite CS0201, CS0203
CS0206 OPERATING SYSTEMS Prerequisite CS0201, CS0203 L T P C 3 0 0 3 PURPOSE Every computer professional should have a basic understanding of how an operating system controls the computing resources and
Web Server Architectures
Web Server Architectures CS 4244: Internet Programming Dr. Eli Tilevich Based on Flash: An Efficient and Portable Web Server, Vivek S. Pai, Peter Druschel, and Willy Zwaenepoel, 1999 Annual Usenix Technical
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.
Chapter 6 Concurrent Programming
Chapter 6 Concurrent Programming Outline 6.1 Introduction 6.2 Monitors 6.2.1 Condition Variables 6.2.2 Simple Resource Allocation with Monitors 6.2.3 Monitor Example: Circular Buffer 6.2.4 Monitor Example:
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
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
Real Time Control Under UNIX for RCCL
1 Real Time Control Under UNIX for RCCL (3rd International Symposium on Robotics and Manufacturing Vancouver, Canada, July 18-20, 1990) John Lloyd and Mike Parker McGill University, Research Center for
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
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
University of Dayton Department of Computer Science Undergraduate Programs Assessment Plan DRAFT September 14, 2011
University of Dayton Department of Computer Science Undergraduate Programs Assessment Plan DRAFT September 14, 2011 Department Mission The Department of Computer Science in the College of Arts and Sciences
Tools Page 1 of 13 ON PROGRAM TRANSLATION. A priori, we have two translation mechanisms available:
Tools Page 1 of 13 ON PROGRAM TRANSLATION A priori, we have two translation mechanisms available: Interpretation Compilation On interpretation: Statements are translated one at a time and executed immediately.
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
CS5460: Operating Systems. Lecture: Virtualization 2. Anton Burtsev March, 2013
CS5460: Operating Systems Lecture: Virtualization 2 Anton Burtsev March, 2013 Paravirtualization: Xen Full virtualization Complete illusion of physical hardware Trap _all_ sensitive instructions Virtualized
