OPERATING SYSTEMS - PowerPoint PPT Presentation

About This Presentation
Title:

OPERATING SYSTEMS

Description:

Prezentace aplikace PowerPoint - vutbr.cz ... bu01 – PowerPoint PPT presentation

Number of Views:35
Avg rating:3.0/5.0
Slides: 15
Provided by: Macu59
Category:

less

Transcript and Presenter's Notes

Title: OPERATING SYSTEMS


1
OPERATING SYSTEMS
  • BU01

2
Main tasks of Operating System
  • To hide HW specifics (abstract layer for
    programs)
  • Processes maintenance
  • Memory maintenance
  • Files maintenance
  • I/O maintenance (peripheral devices)
  • Network maintenance
  • Permissions and access
  • User Graphics Interface

3
Processes
  • Process - executed program containing sequence of
    instructions realizing some algorithms. Each
    process consumes some computer resources
  • time of processor
  • part of operating memory
  • some peripheral devices
  • disk space
  • etc.
  • Operating system is responsible for following
    manipulating with process
  • Creating (loading) and running of process
  • Terminating and deleting of process
  • Suspending and resuming of process

4
States of processes
  • new
  • process is loaded into memory, creating a new
    record in table of processes
  • run
  • processor executes instructions of process
  • wait
  • processor does not executes instructions of
    process, process is waiting for some event (e.g.
    finishing of I/O device operation)
  • ready
  • process is loaded and waiting for starting
  • terminated
  • process has been finished but not deleted yet
  • Operating system provides to the process
    requested services (access to the devices,
    increases amount of the memory for process,
    arranges communication between processes etc.)
  • Process description, process attributes, and
    state are stored in the table of processes PCB
    Process Control Block.

5
Properties of process
  • Important attributes of process
  • Unique Identifier PID (process ID). Integer
    number depends on the history.
  • Permissions of process. Each process runs with
    permissions of some user. Full permissions has
    the user "administrator, "system", resp. "root".
  • Priority of process. According to this level the
    resources are assigned to the process in
    comparison with another ones.
  • Name of process. Derived from the name of the
    file that process was loaded from.
  • OS can evaluate CPU and memory consumption of
    running process.
  • OS can also evaluate number of bytes sent by
    process to/from particular I/O device.
  • Process can create subprocess with attributes
    inherited from parent process. (Parental child
    process).
  • OS consists of system processes (they run in
    privileged and normal regime).

6
Preemptive and cooperative architecture
  • Preemptive OS provides to processes only limited
    time interval of processor. After this interval
    (some ms) is process changed into the
    "wait-status" and another process in the queue is
    activated. During the suspension of process OS
    has to store all information allowing the
    process to be resumed ( great overhead, but
    enables multitasking) .
  • Various OS use various algorithms for processes
    planning and processor assigning (process
    scheduling). Process priority and OS requests
    must be evaluated. More processor kernels
    complicates this evaluating. Main goal using the
    processor in the best wait with minimal overhead
    of process maintenance.
  • Cooperative OS assigns the processor to the
    process (jump instruction), but the process must
    return the processor to the OS in its own
    overhead (jump instruction to entry point of OS).

7
Threads
  • Process is container of threads. Each thread runs
    relatively independent and inherits from process
    its resources and permissions.
  • Each process contains one thread at least.
    Instructions performed by processor in fact
    belongs rather to the thread than process.
  • Processes are isolated and can communicate only
    through services of operating system. Unlike
    processes, threads of one process can communicate
    in direct way by sharing of memory space.
  • Threads can also create, terminate or suspend
    another threads of the same process. In PC with
    many processors or multikernel processor each
    kernel is assigned to various thread
    automatically by OS.
  • Useful technique is to create particular thread
    for resources demand computation to protect
    another activity (especially GUI) from blocking.
  • E.g. For each request to the web server there is
    one independent thread created to handle the
    request and send a response.

8
Memory maintenance
  • Instructions can contain addresses of data or
    another instruction (jumps). There is a problem
    of address adjusting without knowledge of future
    location of process in operating memory.
  • Solution during programming process the
    programmers use logical (virtual) addresses. Real
    (physical) address consists of logical address
    adding the content of special relocation register
    of processor. This register is set up by OS for
    each process to secure their own memory.
  • Difference between logical and physical address
    schematically
  • Processor obtains jump instruction to address 123
  • Contain of relocation register 80000
  • Resulting address in the memory where the jump
    will be realized to, is the sum 80123
  • While content of relocation register is constant
    during the process existence each
    address-oriented instructions will work correctly
    despite of random placing the process.
  • Memory fragmentation problem

9
Memory paging
  • To protect the memory from fragmentation paging
    mechanisms is used
  • Physical memory is divided into the frames of
    the same size (4 KB).
  • Logical memory is divided by the same way into
    the pages of the same size.
  • Before starting the process OS analyzes needed
    number of frames. The table of pages is created
    addresses of free frames are assigned to each
    logical page.
  • There is continuous logical space for each
    process, each address in instructions is
    relocated into the addresses in the space of free
    frames. Physical memory space where process is
    placed can be discontinuous.
  • Maximal unused space for process is 4 KB.
  • This mechanisms of memory paging is supported by
    modern processors starting Intel 80386
  • Process cannot use frames outside its space
    guaranteed by processor
  • Manipulating of relocation registry content is
    evidently dangerous. That is why these
    instructions are performed only for OS not for
    standard processes. Process of OS runs in
    privileged regime.

10
Virtual memory
  • Through the mechanisms of physical and logical
    pages OS can provide to the process the amount of
    memory greater than its physical limit.
  • Rarely used pages can by removed from the memory
    to the special disk file (swapfile). Released
    space can be used by the new process (swapping).
  • Table of pages has the flag for each page
    indicating that the page is in memory space (and
    can be used) or the pages is swapped and must be
    resumed before using. In that case the page is
    reloaded into the free frame and the page table
    is repaired.
  • There is a great number of algorithms to minimize
    transport of pages between memory and disk.
  • In case of running too many process
    simultaneously the swapping process is active and
    the system performance goes down. On the other
    hand this situation is better than crash. In any
    case we can some of the unused process terminate.

11
Filesystem System of files
  • Information stored on peripheral memory is
    organized as system of files (logical units of
    data or programs).
  • Structure of this system of files is different
    according to
  • Operating system
  • Type of peripheral memory
  • File is identified by its name and included into
    the hierarchy of folders (directories)
  • Access to the File System (moving the file
    into/from the system memory) is allowed only
    through the services of operating system.
  • Operating system contain abstract layer hiding
    specific organization and file structure. Files
    can be stored not only on magnetic disks, as well
    as other devices (flash drive, CD, DVD, magnetic
    tape, file system on another computer across a
    network, etc.).
  • Programs working with files can use the same
    operating system services (so-called logical or
    Virtual file system).

12
Access layers to filesystem
  • At the lowest level are custom disk controller
    drivers that transmit data between disks and
    memory.
  • Subroutines of the next layer use the services of
    drivers to allow reading and writing the
    required sectors (Basic File System).
  • Another layer already contains information about
    the general distribution of occupied sectors and
    their belonging to the files (File Organization
    Module).
  • The last layer, which is then used by user
    programs (so called application layer), organizes
    files into directories, assigns file attributes
    (owner, permissions, time of creation, etc.) and
    allows programs own reading and writing files
    (Logical File System).
  • The first three layers are usually unavailable
    for normal programs.

13
Filesystems Metadata
  • Information of the distribution of files on
    individual sectors of the disk, and their
    attributes are also stored on the disk in the
    system tables, called metadata.
  • When working with a file an application layer
    creates entry in the metadata - a special data
    structure describing the file to disk (FCB - File
    Control Block).
  • FCB contains the file attributes (owner, access
    permissions, size, creation time, etc.) and a
    list of sectors in which the file is located.
  • Layer hierarchy of operating system for file
    system ensures that when changing the contents of
    the file structure FCB is changed synchronously
    (delete, transfer of data, create a new text
    file, etc.)
  • Because of acceleration is a copy of FCB stored
    in the memory and only after the closing of the
    file is copied to the disk.
  • Missing file closing can lead to the file
    damaging.

14
Allocation unit
  • FAT file system disk is divided into allocation
    units (clusters) consisting of the constant
    number of consecutive sectors. Metadata contains
    the FAT (File Allocation Table) - list of cluster
    numbers containing the file (concatenated list).
  • For each file is required one cluster at least.
    If the file does not fit exactly into a number of
    allocation units, the capacity of the disk
    remains unused.
  • The numbers in the table allow addressing FAT
    clusters according to their range (e.g. the
    numbers stored in 16 bits (FAT16) can address up
    to 216 65 636 clusters)
  • The minimum possible size of the cluster grows
    proportional to the total capacity of the disk.
    Larger clusters, however, always lead to worse
    effective capacity.
  • One of the methods to introduce smaller clusters
    on large drives the division of the total disk
    capacity in the area (partitions) that behave as
    independent disks (they contain their own tables
    FAT).
  • Another method is based on larger numbers
    addressing clusters (FAT32 can contain about
    4,000,000,000 clusters).
  • Disk fragmentation.
Write a Comment
User Comments (0)
About PowerShow.com