2013年10月12日 星期六

[IOS] Ch1 Introduction note #2


Caching

  • Important principle, performed at many levels in a computer (in hardware, operating system, software)
  • Information in use copied from slower to faster storage temporarily
  • Faster storage (cache) checked first to determine if information is there 
    • If it is, information used directly from the cache (fast)
    • If not, data copied to cache and used there
  • Cache smaller than storage being cached
    • Cache management important design problem
    • Cache size and replacement policy



Computer-System Architecture

Multiprocessor 
A multiprocessor is a tightly coupled computer system having two or more processing units (Multiple Processors) each sharing main memory and peripherals, in order to simultaneously process programs.
A tightly coupled system is a multiprocessor computing system in which the CPUs are connected together in such a way that they share some or all of the system’s memory and I/O resources.
Reference: http://en.wikipedia.org/wiki/Multiprocessor

Advantages include:
  1. Increased throughput
  2. Economy of scale
  3. Increased reliability – graceful degradation or fault tolerance

Multiprocessing
Multiprocessing is the use of two or more central processing units (CPUs) within a single computer system, also refers to the ability of a system to support more than one processor and/or the ability to allocate tasks between them.

Multiprocessing refers to computers with more than one processor. 
A multiprocessing computer can execute multiple threads simultaneously, one thread for each processor in the computer. Multiple-processor computers are commonly used as high-end server platforms, hosts for multi-user interactive sessions, and single-user systems for running resource intensive desktop applications.
Multiprocessing operating systems can be either asymmetric or symmetric. The main difference is in how the processors operate.

Note: Do not confuse multitasking with multiprocessing. 
Multitasking is an operating-system technique for sharing a single processor among multiple threads (small, independent executable components of applications) of execution. 
A multitasking operating system only appears to execute multiple threads at the same time; a multiprocessing operating system actually does so.

Difference between asymmetric and symmetric multiprocessing 
Asymmetric multiprocessing  (ASMP) -  
Operating system typically sets aside one or more processors for its exclusive use. The remainder of the processors run user applications. 
As a result, the single processor running the operating system can fall behind the processors running user applications. 
This forces the applications to wait while the operating system catches up, which reduces the overall throughput of the system. 
In the ASMP model, if the processor that fails is an operating system processor, the whole computer can go down.

Symmetric Multiprocessing (SMP) -
Used to get higher levels of performance.
In SMP any processor can run any type of thread.
The processors communicate with each other through shared memory.
SMP systems provide better load-balancing and fault tolerance. Because the operating system threads can run on any processor, the chance of hitting a CPU bottleneck is greatly reduced.
All processors are allowed to run a mixture of application and operating system code.
A processor failure in the SMP model only reduces the computing capacity of the system.
SMP systems are inherently more complex than ASMP systems.
A tremendous amount of coordination must take place within the operating system to keep everything synchronized. For this reason, SMP systems are usually designed and written from the ground up.


Cluster Systems

  • Like multiprocessor systems, but multiple systems working together
    • Usually sharing storage via a storage-area network (SAN)
    • Provides a high-availability service which survives failures
      • Asymmetric clustering has one machine in hot-standby mode
      • Symmetric clustering has multiple nodes running applications, monitoring each other
    • Some clusters are for high-performance computing (HPC)
      • Applications must be written to use parallelization
Asymmetric clustering: one server runs the application while other servers standby.

­Symmetric clustering: all N hosts are running the application. Centralized systems act as server systems to satisfy requests by client systems.


Operating System Structure

  • Multiprogramming needed for efficiency
    • Single user cannot keep CPU and I/O devices busy at all times
    • Multiprogramming organizes jobs (code and data) so CPU always has one to execute 
    • All the jobs are kept initially on the disk in the job pool 
    • A subset of total jobs (in the job pool) in system is kept in memory
    • One job selected and run via job scheduling 
    • When it has to wait (for I/O for example), OS switches to another job
    • Multiprogrammed systems provide an environment in which the various system resources (for example, CPU, memory, and peripheral devices) are utilized effectively, but they do not provide for user interaction with the computer system.
       
  • Timesharing (multitasking) is logical extension in which CPU switches jobs so frequently that users can interact with each job while it is running, creating interactive computing
    • Response time should be < 1 second
    • Each user has at least one program executing in memory (process)
    • If several jobs ready to run at the same time (CPU scheduling) 
    • If processes don’t fit in memory, swapping moves them in and out to run
    • Virtual memory allows execution of processes not completely in memory
    • 相較於 multiprogramming 會花更多時間在 I/O (因為頻繁切換),所以不是每次都全部 load & unload 到 main memory,而是切小區塊,每次只 load 接下來要用到的區塊

Operating-system Operations

  • Interrupt driven by hardware
  • Software error or request creates exception or trap
    • Division by zero, request for operating system service
  • Other process problems include infinite loop, processes modifying each other or the operating system
  • Dual-mode operation allows OS to protect itself and other system components
    • User mode and kernel mode
    • Mode bit provided by hardware
      • Provides ability to distinguish when system is running user code or kernel code
      • Some instructions designated as privileged, only executable in kernel mode
      • System call changes mode to kernel, return from call resets it to user
Timer
  • Timer to prevent infinite loop / process hogging resources
    • Set interrupt after specific period
    • Operating system decrements counter
    •  generally implemented by a fixed-rate clock and a counter.
    • When counter zero generate an interrupt
    • Set up before scheduling process to regain control or terminate program that exceeds allotted time







Reference:  
Operating System Concepts 8th, by Silberschatz, Galvin, Gagne
Wikipedia




沒有留言:

張貼留言