Operating Systems Part 1 - PowerPoint PPT Presentation

1 / 31
About This Presentation
Title:

Operating Systems Part 1

Description:

How do we communicate/interact with the computer? ... An Operating System, or OS, is a piece of ... A monolithic OS is one where the entire OS is one big 'blob' ... – PowerPoint PPT presentation

Number of Views:51
Avg rating:3.0/5.0
Slides: 32
Provided by: webhome2
Category:

less

Transcript and Presenter's Notes

Title: Operating Systems Part 1


1
Operating Systems Part 1
2
Motivation
  • How do we get our applications (programs) to
    easily communicate with the vast array of
    hardware devices?
  • How do we communicate/interact with the computer?
  • How do we ensure safe and secure access to
    resources?

3
Operating Systems
  • An Operating System, or OS, is a piece of
    software which resides between the underlying
    hardware and the programs we as users run

4
Operating Systems
5
Operating Modes
  • There are two main operating modes in a
    computer
  • User mode
  • Real mode (sometimes called kernel mode, or
    privileged mode)

6
User Mode
  • The mode in which user applications run
  • Limited access to resources
  • Ex can only access memory which a particular
    application owns
  • Only certain operations allowed
  • Generally cannot access hardware directly

7
Real Mode
  • The mode in which most of the OS runs
  • Why not all?
  • Full access to hardware and memory
  • Full access to all instructions
  • Can access hardware directly

8
OS Architectures
  • How do we organize an operating system?
  • Monolithic
  • Layered approach
  • Microkernel

9
Monolithic OS's
  • A monolithic OS is one where the entire OS is one
    big blob
  • Characterized by little or no system organization
  • All OS subsystems are interdependent
  • Pros? Cons?

10
Monolithic OS's
  • Pros
  • Tend to be fast (very little overhead)
  • Cons
  • Tend to be extremely difficult to maintain
  • Difficult to add new features

11
Layered Approach
  • The OS is divided into independent subsystems or
    layers each of which is built on top of other
    layers

12
Layered Approach
Source Operating System Concepts,
Silberschatz, 6th Ed, p78
13
Layered Approach
  • Pros?
  • Cons?

14
Layered Approach
  • Pros
  • Modularity
  • Each layer doesn't need to know about internal
    details of any other (encapsulation)
  • Cons
  • Can be slower
  • Determining what each layer should do

15
Microkernel Approach
  • Where the portion of the OS which runs in real
    mode (the kernel) is kept extremely small, and
    delegates work to modules which run in user mode.
  • Pros? Cons?

16
Microkernel Approach
  • Pros
  • Small kernel, thus less time spent in real mode
  • Arguably safer and more secure
  • Easy to add new features
  • Cons
  • Switches between user and real mode are more
    frequent slower performance

17
Which is best?
  • So which is the best architecture?
  • Open to debate
  • Most use some aspects of each of the previously
    mentioned architectures
  • One of the most famous debates about OS
    architecture is the Torvalds-Tannenbaum debate

18
And in this corner....
Andrew Tannenbaum
Linus Torvalds
19
The Torvalds-Tannenbaum Debate
  • Linus Torvalds is the originator of the Linux
    operating system
  • Andrew Tannenbaum is a famous professor and
    researcher in computer science in the Netherlands
  • Full text can be found at

http//www.oreilly.com/catalog/opensources/book/ap
pa.html
20
Operating System Responsibilities
  • The OS has a number of responsibilities
  • Providing a User Interface (UI)
  • System Security
  • Efficient Allocation of Resources
  • Safe Use of Resources

21
The User Interface
  • The portion of a OS which allows a user to
    interact with the system
  • Can be command-line or graphical (GUI)
  • What is Windows?

22
Safe Use of Resources
  • Ensuring the safe use of resources can take many
    forms
  • We will look at one potential problem deadlock
  • But first, lets talk philosophy....

23
The Dining Philosophers Problem
  • Lets say that there are a number of philosophers
    sitting down at a table to eat dinner.
  • Each philosopher has access to two chopsticks to
    eat with, one to their left, and one to their
    right.
  • They need both chopsticks to eat.

24
Source http//en.wikipedia.org/wiki/ImageDining_
philosophers.png
25
Dining Philosophers
  • A problem arises if each philosopher is holding
    a chopstick, then neither can eat unless another
    philosopher gives up his/her chopstick.
  • Thus we have reached a state of deadlock.

26
Deadlock
  • When progress in a system cannot continue because
    active programs in the system hold resources that
    other programs need to continue (and vice-versa)
  • How can we deal with deadlock?
  • Deadlock recovery
  • Deadlock prevention

27
Deadlock Prevention
  • Tries to prevent deadlock from happening by
    eliminating the possibility of it occurring
  • E.G. Coffman made the observation that in order
    for deadlock to occur, four conditions must hold.

28
Coffman's Four Necessary Conditions of Deadlock
  • Mutual exclusion a resource can be owned by at
    most one program
  • Hold and wait a program which holds a resource
    may request other resources
  • No preemption only a process holding a resource
    may give it up
  • Circular wait two or more programs form a
    circular chain where each waits for a resource
    the next program holds

29
Deadlock Prevention
  • Thus to prevent deadlock we just make one of the
    four necessary conditions impossible to happen
  • Easy in theory, very hard in practice!
  • Learn more in CSC360 (Bankers algorithm, etc)

30
Deadlock Recovery
  • Rather than avoiding deadlock, deadlock recovery
    detects when the system has entered a state of
    deadlock and tries to recover
  • How do we recover?

31
Recovery Techniques
  • Many possibilities
  • Abort all deadlocked programs
  • Abort one program at a time until deadlock ceases
  • Forcing a program to give up its owned resources
Write a Comment
User Comments (0)
About PowerShow.com