Operating Systems

Operating Systems

Operating Systems Processes (Ch 3.1) Processes A program in execution Modern computers allow several at once pseudoparallelism A Program Counter B C A

B C Conceptual View A B C Time Processes A program in execution main() {

... } A() { } main() { ... } A() { } Heap A Stack main

more than a program: ls, tcsh less than a program: gcc blah.c (cpp, cc1, cc2, ln ) A sequential stream of execution in its own address space Process States Consider: cat /etc/passwd | grep claypool Exit

New Running Dispatch I/O Wait Interrupt Ready I/O Complete Waiting (Hey, you, show states in top!) Design Technique: State Machines

Process states Move from state to state based on events Reactive system Can be mechanically converted into a program Other example: string parsing, pre-processor Unix Process Creation System call: fork()

creates (nearly) identical copy of process return value different for child/parent System call: exec() over-write with new process address space Shell uses fork() and exec() simple! (Hey, you, show demos!) Process Scheduler cat

ls ... disk vid Scheduler All services are processes Small scheduler handles interrupts, stopping and starting processes Process Control Block Each process has a PCB

state program counter registers memory management OS keeps a table of PCBs, one per process (Hey! Simple Operating System, system.h) Interrupt Handling

Stores program counter (hardware) Loads new program counter (hardware) jump to interrupt service procedure Save PCB information (assembly) Set up new stack (assembly) Set waiting process to ready (C) Service interrupt (C and assembly) Scheduler (C) Newly awakened process + Often called a context-switch Previously running process Context Switch

Pure overhead So fast, fast, fast typically 1 to 1000 microseconds Sometimes special hardware to speed up Real-Time wants worse case RT Linux worse case sub 20 microseconds How to decide when to switch contexts to another process is process scheduling Linux Context Switch Times (http://math.nmu.edu/~benchmark/)

Measured with LMBench Processes in Linux PCB is in struct task_struct states: RUNNING, INTERRUPTIBLE, UNINTERRUPTIBLE priority: when it runs counter: how long it runs

Environment inherited from parent NR_TASKS max, 2048 1/2 is max per user Processes in Windows States: ready, standby (first in line), running, waiting, transition, terminated priority - when it runs Processes are composed of threads (revisit threads after synchronization)

Recently Viewed Presentations

  • Disassembling Products - Vivienne Clark

    Disassembling Products - Vivienne Clark

    Disassembling Products Textiles and New design ideas also for long-term Green Design Disassembling Products Obtain the information directly by taking measurements from existing products (disassembling an existing product); Advantages to the manufacturer • to analyse and evaluate existing products of...
  • Biological approaches to psychology Simple revision points What

    Biological approaches to psychology Simple revision points What

    It reduces everything to a simple level; depression may actually be an appropriate response to a bad situation and not a physical illness. Our behaviour often only makes sense if you look at the meanings people put to what they...
  • Creating heaven on earth - Be the change you want to see....

    Creating heaven on earth - Be the change you want to see....

    "The spiritual man judgethof all things and he himself is judged by no man" [1 Cor 2:15]. This authority, however, (though it has been given to man and is exercised by man), is not human but rather divine,...
  • Beyond the Bell Training for After School Snack Programs

    Beyond the Bell Training for After School Snack Programs

    How to complete the SFSP CMS production worksheet for columns 7 Amount prepared, 11 Amount leftover, and the Comments section. Transfer from the production worksheets counts into the CMS production record tabs. Item Counts. Meals/Revenue . Daily Comments/Menu. Completing CMS...
  • Homecrest Presbyterian Church Worship of the Lords Day

    Homecrest Presbyterian Church Worship of the Lords Day

    God delights in us when we honestly confess and repent from our hearts. In humility and faith, let us lift up our confession before God and our neighbors. Gathering Around the WORD Prayer of Confession ... Sharing of Joys and...
  • MATH LEARNING PROGRESSION Introduction Math Selected Themes Assessment

    MATH LEARNING PROGRESSION Introduction Math Selected Themes Assessment

    Introduction. Math Selected Themes. Assessment targets. Progress Map. MathLearning Progression. In this set of slides we'll be discussing the specific theme we'll use throughout the next few chapters, and using to develop and score our items.
  • Recursive Proofs for Inductive Tree Data-Structures

    Recursive Proofs for Inductive Tree Data-Structures

    Overview. Invariant Synthesis and Machine Learning (1:15hr) Inductive synthesis of invariants using learning: iterative ICE model The ``gaps'' we need to bridge in adapting ML algorithms to invariant synthesis Machine learning: Classification algorithms (1:00hr)Learning conjunctions, Linear Threshold Functions, Winnow, Perceptron,...
  • Unitary Process Nursing Theories - JustAnswer

    Unitary Process Nursing Theories - JustAnswer

    Chapter 9 Grand Nursing Theories Based on Unitary Process