[OS] Introduction 1

Updated:

Introduction Part 1

What is Operating System

  • A program that acts as an intermediary between a user of a computer and the computer hardware

Operating System goals

  • Provide an environment to execute user programs(application programs)
  • Make the computer system convenient to use
  • Control the computer hardware in an efficient manner

Computer System Structure

Computer system can be divided into four components

  • Hardware (CPU, memory, I/O devices, etc…)
  • Operating System
  • Appliction programs
  • Users

computer_System

  • Operating system controls functions to use hardware so that application program could just use abstraction(READ, WRITE, etc…)

What Operating Systems Do

  • Resource allocator
    • decides between conflicting requests for efficient and fair resource use
  • Control program
    • controls execution of programs to prevent errors and improper use of the computer
  • Control I/O devices and file system

Core functionality of the operating system is kernel which manage all resources and control the abstraction of the hardware


How does a computer operate?

Booting_1

Booting

  • Turn on the computer
  • Bootsrap program is executed and the OS loaded to the memory
  • Initialize all aspects of system (resource)

Bootstrap program (typically stored in ROM or EPROM) is a program for loading operating system to the memory

booting_2

Computer System Organization

os_organ One or more CPUs, device controllers connect through common bus providing access to shared memory.
Concurrent execution of CPUs and devices competing or memory cycles.

Computer System Operation

  • I/O devices and the CPU can execute concurrently
  • CPU moves data from/to main memory to/from local buffers
  • I/O is from the device to local buffer of control
  • Device controller informs CPU that it has finished its operation by causing an interrupt interrupt

Common Functions of Interrupts

  • Why interrupt occur?
    • Speed of I/O computations are much slower than the speed of CPU computations
    • To use CPU efficiently (OS don’t want CPU to get some rest…), when I/O computations are done, then I/O device controller informs CPU by Interrupt
    • Interrput architecture should save the address of the interrupted instruction, so they save the address to the interrupt vector.
  • Interrupt Process
    • Process A make interrupt
    • CPU store the present status (processes that CPU is controlling now) to PCB (Process Control Block)
    • Store the command to PC(Program Counter) which should be resumed after interrupt solved
    • Read Interrupt vector and get the addresses of ISR(Interrupt Service Routine)
    • Execute the first command of Interrupt
    • Interrupt solved
    • Come back to previous process by using addresses stored in PC(Program Counter)

Interrupt Handling

The operating system preserves the state of the CPU by storing registers and the program counter interrupt

cf. Polling : CPU manages all computations to check whether the target event occurred or not, which means that nothing could be done before the target event occurred

I/O Structure

Device controllers are used to transfer I/O data between the peripheral and device driver/operating system

  • device driver loads appropriate registers within the device controller
  • device controller determines the actions to take based on the register setting
  • device controller starts transer of data between device and its buffer
  • device controller informs device driver that the I/O transfer is over and the OS should take control of the system

Storage definitions and notations

  • Bit = 0 or 1
  • Byte = 8 bits
  • Word : A computer architecture’s native unit of data
    • 32-bit architecture : 32 bits = 4 bytes = 1 word
    • 64-bit arhcitecture : 64 bits = 8 bytes = 1 word
  • Multiple bytes
    • Kilo = 1024 = 2^10
    • Mega = 1024^2 = 2^20
    • Giga = 1024^3 = 2^30
    • Tera, peta, …

Storage Structure

  • Main memory : large storage media that CPU can access directly
    • RAM (Random Access Memory) : volatile
    • ROM (Read Only Memory) : non-volatile
  • Secondary Storage : extension of main memory that provides large non-volatile storage capacity
    • Hard disk
    • SSD (Solid-state disk)

Storage-Device Hierarchy

hierarchy

Caching

Caching is an action to store data in high-level storage so that future requests for that data can be served faster. The data stored in a cache might be the result of an earlier computation or a copy of data stored elsewhere.
A cache hit occurs when the requested data can be found in a cache, while a cache miss occurs when it cannot. Cache hits are served by reading data from the cache, which is faster than recomputing a result or reading from a slower data store. Thus, the more requests that can be served from the cache, the faster the system performs.

Direct Memory Access Structure

von

  • used for high-speed I/O devices able to transmit information at close to memory speeds
  • device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention
  • Only one interrupt is generated per block, rather than the one interrupt per byte
  • cause competition between several devices(CPU, Memory, Controller, etc.) on system bus, so need to control them

Leave a comment