operating systems n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Operating Systems PowerPoint Presentation
Download Presentation
Operating Systems

Loading in 2 Seconds...

play fullscreen
1 / 13

Operating Systems - PowerPoint PPT Presentation


  • 91 Views
  • Uploaded on

Operating Systems. Processes (Ch 3.1). A. A. C. B. B. C. Processes. “A program in execution” Modern computers allow several at once “pseudoparallelism”. A. Program Counter. B. Conceptual View. C. Time. main() { ... } A() { … }. Processes. “A program in execution”.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Operating Systems' - suchi


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
operating systems

Operating Systems

Processes

(Ch 3.1)

processes

A

A

C

B

B

C

Processes
  • “A program in execution”
  • Modern computers allow several at once
    • “pseudoparallelism”

A

Program

Counter

B

Conceptual View

C

Time

processes1

main() {

...

}

A() {

}

Processes
  • “A program in execution”

main() {

...

}

A() {

}

Heap

Stack

A

main

    • “more” than a program: ls, tcsh
    • “less” than a program: gcc blah.c
      • (cpp, cc1, cc2, ln …)
  • “A sequential stream of execution in it’s own address space”
process states

Running

Ready

Waiting

Process States
  • Consider:

cat /etc/passwd | grep claypool

Exit

New

Dispatch

I/O Wait

Interrupt

I/O Complete

(Hey, you, show states in top!)

design technique state machines
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
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

...

Process Scheduler

cat

ls

disk

vid

  • All services are processes
  • Small scheduler handles interrupts, stopping and starting processes

Scheduler

process control block
Process Control Block
  • Each process has a PCB
    • state
    • program counter
    • registers
    • memory management
  • OS keeps a table of PCB’s, one per process
  • (Hey! Simple Operating System, “system.h”)
interrupt handling
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
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
Linux Context Switch Times

Measured

with

LMBench

(http://math.nmu.edu/~benchmark/)

processes in linux
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
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)