Chapter 3: OS and Networks - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

Chapter 3: OS and Networks

Description:

Chapter 3: OS and Networks. With the number of resources ... UNIX has many shells like Borne, C, Korn. Operating System. Shell. User. User. User. Boot Program ... – PowerPoint PPT presentation

Number of Views:57
Avg rating:3.0/5.0
Slides: 28
Provided by: rfo7
Category:
Tags: chapter | korn | networks

less

Transcript and Presenter's Notes

Title: Chapter 3: OS and Networks


1
Chapter 3 OS and Networks
  • With the number of resources available, we need
    Operating Systems and Networks
  • The OS helps us control and use a variety of
    resources
  • Network resources
  • printers
  • file servers
  • other computers (through telnet, ftp, etc)
  • Local resources
  • CPU
  • main memory
  • disk drive(s) and other storage devices
  • sound card, monitor, keyboard, etc
  • We will examine the OS and network
  • their roles and responsibilities

2
Evolution of the Operating System
  • Early computers single process systems
  • punch cards, mounting tapes, setting switches
  • each job run by itself
  • programmers were the only users, acted as system
    monitors
  • This led to early OSs where the system was
    responsible for handling batch processing chores
  • programmers submitted their jobs remotely or
    through an operator and did not have to
    physically enter the computer room
  • jobs waited on secondary storage in a job queue
    (first-in first-out structure)
  • see figure 3.1 p. 121

3
Further Evolution
  • As hardware evolved, so did the OS
  • resources accessed through job control cards
  • change from punch cards to terminals
  • change from single-user to multi-user systems
  • interactive environment through time sharing
    (multitasking)
  • see figure 3.2 p. 122
  • Today
  • system administrator (instead of operator)
  • software and hardware installation rather than
    the day-to-day running of the computer system
  • PCs replace terminals connected to
    mainframe/minicomputer
  • Graphical User Interfaces (GUI)
  • Multitasking commonplace

4
Multiprocessor Systems
  • May be in a single computer (parallel computer)
    or distributed across a network
  • Distributed systems are much more common than
    parallel computers
  • By networking PCs, we have power equal to
    mainframe computers but at a much cheaper cost
  • The coordination problems of a network are
    essentially the same faced in a multitasking
    operating system and so we can view the control
    of a network as being that of a distributed
    operating system
  • Networks allow for load balancing which can be a
    difficult task to perform, but suffer from lack
    of scalability
  • We will examine networks in detail in sections
    3.5 and 3.6

5
Uniformity of OSs good or bad?
  • There used to be many OSs available for PCs, but
    today, we essentially see Microsoft and Macintosh
    -- is uniformity good or bad?
  • Pros once you learn the OS, you can use it on
    any computer application software development is
    simplified
  • Cons gives the producer of the OS tremendous
    power in the marketplace that, if misused, could
    potentially harm the marketplace -- is MS
    trustworthy?
  • Currently, there is an antitrust suit against MS

6
Types of software
  • Applications Software
  • Software we run
  • word processor
  • spreadsheet
  • database
  • graphics program
  • games
  • System Software
  • Software that the computer uses to maintain its
    own environment
  • Utilities include system add-ons like antiviral
    software, screensavers, communication software
    and compression- decompression software

Software
Applications Systems
Utility Operating System
Shell Kernel
7
The Operating System
  • Shells user interfaces including GUIs
  • Windows 3.1 is a shell on top of MS-DOS
  • UNIX has many shells like Borne, C, Korn
  • The remainder of the systems software is the OS
    itself
  • The Kernel the core programs that make up the
    OS, that are always part of the OS
  • memory manager and memory architecture
  • virtual memory, page size,
  • process manager
  • scheduler, dispatcher, process synchronization
  • device drivers
  • file manager

User
Operating System
User
Shell
User
8
Boot Program
  • In order to use modern computers, the OS must be
    loaded and running
  • The OS is loaded into RAM
  • But when the computer is first turned on, RAM is
    empty!
  • How do we get the computer to load any program
    (including the OS) if the OS is not already
    loaded and running?
  • Boot strapping (or booting) is the first thing
    that the computer does when turned on
  • The boot program is stored in ROM (and possibly a
    part of it resides on hard disk)
  • Boot process
  • CPU references a preset location in memory (in
    ROM)
  • This boot program then tests the system (memory,
    attached peripherals)
  • Performs initialization of registers and memory
    values
  • loads the kernel of the OS from a predetermined
    location (floppy disk, optical disk, hard disk)
  • CPU branches to the first instruction in RAM of
    the OS kernel
  • See figure 3.5 p. 131

9
Concept of a Process
  • The process is a program in an executing state
  • this is the basic unit of the operating system
  • as opposed to the instruction which is the basic
    unit for the CPU
  • the process state is the current status of the
    process and includes its
  • execution status (executing, ready, waiting,
    terminated)
  • value of registers (program counter, instruction
    register, general-purpose registers, status
    flags)
  • resources (open files, memory)
  • other information (accounting information, owner,
    priority)

10
Process Administration
  • Multitasking or time-sharing systems are
    responsible for handling several active processes
  • System maintains a process table that stores the
    process state of each process
  • Ready processes wait in a ready queue
  • When the CPU is available, the dispatcher selects
    a process to move to the CPU
  • The CPU executes some number of cycles on this
    process
  • this number is known as the quantum or time
    slices (e.g. 50 milliseconds)
  • If quantum elapses (or process requires an OS
    service like I/O), CPU is interrupted and
    performs a process switch
  • See figure 3.6 p. 133

11
Interrupts
  • An Interrupt is when the CPU is stopped from what
    it is currently doing and forced to do something
    else
  • Interrupts can be initiated by hardware or
    software
  • Hardware timer elapses for a context switch,
    input from keyboard, I/O device completes
  • Software process requests I/O, interprocess
    communication occurs
  • When the interrupt occurs
  • the CPU branches to the proper interrupt handler
    (code stored in a reserved section of main
    memory) that tells it what to do to handle the
    interrupt
  • Once done
  • the CPU resumes what it was doing before
    interruption

12
Interprocess Communication
  • Most software communicates with other software
  • e.g. an application communicates a request to the
    OS to save the current file from memory to disk
  • All of these software components (applications,
    systems software) compete for time slices in the
    CPU
  • The dispatcher (another software component)
    decides which component to execute next
  • In the meantime, the OS must also facilitate IPC
  • One way to do this is to use a client/server
    model
  • client -- software that makes requests of other
    units
  • server -- software that waits for requests and
    then fulfills them

13
Process Competition
  • The CPU and the time slices allocated to a
    process are just one form of resource
  • The OS has many resources
  • main memory, servers, disk drives, individual
    files, etc
  • In a multitasking environment, managing resources
    is critical
  • Without proper management
  • processes would be able to hold onto resources
    indefinitely forcing other processes to wait
  • resources could be misused leading to, among
    other things, corrupt data

14
Example Bank Account
  • Consider the following situation
  • You and your wife have a checking account at a
    bank with a balance of 500
  • You and your wife enter the bank and wait in line
  • You and your wife are both served at the same
    time by two different tellers
  • You tell your teller that you want to withdraw
    the 500 leaving a balance of 0
  • Your wife tells her teller that she wishes to
    withdraw the 500 leaving a balance of 0
  • Each teller performs this task simultaneously
  • You and your wife each walk out with 500,
    meaning that you now have 1000 instead of 500
  • How can this happen?

15
At the machine level
  • Process 1 Process 2 Load R1,
    balance Load R10, balance Sub R2, R1,
    500 Sub R11, R10, 500 JLEZ
    overdraw JLEZ R11, overdraw Store R2,
    balance Store R11, balance ...
  • Notice that only if the balance is less than the
    withdrawal amount do we need to worry about it
    because we skip the Store instruction
  • In a multitasking system both processes are may
    be executed concurrently
  • What happens if the first process executes up to
    the Sub instruction before being interrupted and
    the second process then executes up to or past
    the Sub instruction?
  • Both processes will not perform the Jump
    instruction since R1 and R10 will both store 500

16
Safeguarding against this problem
  • We must protect multiple accesses made to the
    variable balance
  • This memory location becomes a critical section
    which must not be accessed by two (or more)
    processes in an overlapped fashion
  • We must disallow interrupts so that one access
    can be made in its entirety before another access
    is permitted
  • This idea is known as mutual exclusion --
    allowing at most 1 process to access a resource
    at a time
  • How do we implement mutual exclusion to critical
    sections?

17
The Semaphore
  • A very simple idea in which a semaphore is used
    to protect access to a critical section
  • processes requests the semaphore
  • at most, one process is able to have the
    semaphore
  • access to the critical section requires first
    obtaining the semaphore
  • once done accessing the critical section, the
    process releases the semaphore for another
    process
  • the semaphore itself is implemented as an integer
    variable with the value of
  • 1 (if available) or 0 (if currently held)
  • machine languages include uninterruptable
    instructions to manipulate the semaphore (e.g.,
    test-and-set)

18
Deadlock
  • Mutual exclusion leads to its own problem
    deadlock
  • If a process is allowed to hold onto a resource
    until it is done with it, then we could have the
    following situation
  • P0 currently holds R0
  • P1 currently holds R1
  • to continue, P0 needs access to R1
  • to continue, P1 needs access to R0
  • P0 will not be given R1 until P1 no longer needs
    it, but P1 wont give up R1 until it gets R0 and
    P1 cant get R0 until P0 is done with it but P0
    wont give up R0 until it gets R1
  • In this case, P0 and P1 are deadlocked even
    though R0 and R1 are not currently being used!

P0 P1 R0 R1
See figure 3.9 on page 139 for a
real-life deadlock
19
More on Deadlock
  • To handle deadlock
  • deadlock prevention
  • force all processes to request all resources up
    front, only allow a process to proceed if we are
    guaranteed no deadlock can arise
  • deadlock avoidance
  • only grant a resource request if it will not lead
    to deadlock
  • deadlock detection
  • grant any resource request and look for
    deadlocks, if one arises kill off the processes
    that caused the deadlock and randomly restart
    them
  • We can also permit processes to continue rather
    than waiting for a resource by moving some of the
    action off-line through spooling and buffering
  • For deadlock to occur, 3 conditions must be true
  • There is competition for non-shareable resources
  • The resources are requested on a partial basis
  • a process that has received some resources may at
    a later point request more resources
  • Resources are not pre-emptable
  • a resource cannot be forcibly retrieved from a
    process
  • Notice that some resources are non-shareable
  • printer, memory location
  • Some resources are not pre-emptable
  • printer, open disk file

20
Networks
  • Classification LAN and WAN
  • Distinction is usually by location
  • LAN within 1 building or building complex
  • But also by the technology used to link the
    computers together
  • LAN direct cable WAN long distance
    communications
  • Another classification open network or
    proprietary (closed) network
  • Another classification network topology
  • Ring, Bus, Star, Hybrid/irregular

21
The Internet
  • Any network of networks is an internet
  • The Internet is the largest such network
  • a global network that encompasses more than 30
    million computers and tens of thousands of local
    area networks
  • Started out as the ARPAnet in the late 60s
    connecting four local area networks together
  • by the early 70s, more networks were added
  • by the 80s, commercial networks were added, ARPA
    gave control to independent units

22
How does the Internet work?
  • Four key components to the Internet
  • all computers on the Internet speak the same
    language TCP/IP, a network protocol
  • routers are machines that route messages from one
    location to another
  • each local area network on the Internet requires
    a router
  • all computers have a unique Internet address
  • called an IP address
  • domain name servers provide information across
    the Internet so that one machine can learn
    another machines Internet address

23
Internet Domains and Addresses
  • An Internet address is a 32-bit number
  • This number must be unique
  • The number is subdivided into 4 groups of 8 bits
    that determine the domain, local area network and
    machine within the network
  • First byte denotes the domain name (such as edu,
    gov, com, etc)
  • Second byte denotes the specific domain address
    (such as panam or ohio-state)
  • Third byte denotes local area network within the
    domain (such as cs department or tech-res)
  • Fourth byte denotes the computer (host) within
    that LAN
  • For convenience, these 32-bit numbers can be
    represented using aliases (symbolic names) with
    network identifiers used to translate from alias
    to number representation

24
Sending/Receiving messages
  • You want to send a message
  • e.g., http or ftp request, E-mail
  • Your computer packages up the message
  • Local name server looks up in its table the
    destination computers IP address
  • if found, IP address is placed into the message
    and the message is sent off
  • else your name server contacts a domain name
    server on the Internet for the information
  • The message is placed on the Internet
  • sent across the network to all machines in the
    given domain
  • Routers on the Internet listen for messages and
    route the message to the proper subnetwork
  • Within a given subnetwork, all machines listen to
    the network for all messages
  • When a message comes across the subnetwork with
    the given machines address, that machine copies
    it into memory and alerts the OS that a message
    has arrived, all other machines ignore the
    message
  • OS interrupts CPU and handles the message

25
More on the Internet
  • How does your message get to the Internet and how
    do you receive messages?
  • Your computer must connect to an Internet server
    of some kind
  • Panam has a connection through T1 lines that
    connect UTPA to UTSA and through UTSA to the UT
    System which connects to the Internet through
    microwave and satellite communications
  • At home, you can connect through the phone lines
    to an Internet Service Provider
  • AOL, Compuserve, Prodigy, Hiline, Juno, Hotmail,
    etc
  • Some Internet Services
  • Mail service
  • WWW
  • hypertext transfer via http using browsers to
    display text and activate html and Java commands
  • see fig 3.12 for URL example
  • FTP (file transfer protocol)
  • older version of http, files transferred but not
    displayed
  • user must know exact address
  • Telnet (remote login to servers on the Internet)

26
Network Protocols
  • Protocol - set of rules governing communication
  • Communication across a network uses a protocol
  • The protocol is composed of layers
  • Application/usr requests message to be sent
  • OS takes message, wraps it up
  • OS includes error correcting codes and
    destination addresses
  • Name Server finds actual address which is added
    to wrapper
  • message sent...

For two computers to communicate, they must speak
the same protocol Examples include TCP/IP,
Ethernet and ISO
27
Security
  • When dealing with a multi-user system or
    networks, security becomes an issue
  • How do we ensure that the user has the right to
    access a given resource
  • such as access to a given file, a region of
    memory or an E-mail message?
  • The OS maintains security through user rights
    (such as file protection information)
  • User must prove who he/she is through a login
    process using a publicly known login name and a
    secret password
  • Security Violations
  • Notice that passwords may not be secure. Do you
  • use a word that might be guessed (such as your
    name)?
  • share passwords with others?
  • change your password often?
  • write your password down?
  • Network eavesdropping is possible
  • One solution is to encrypt messages
  • Other security problems include
  • Trapdoors, computer viruses, network worms, and
    program trojan horses
Write a Comment
User Comments (0)
About PowerShow.com