Operating Systems Structures and Processes Flashcards

• To describe the services an operating system provides to users, processes, and other systems. • To understand: • What is meant by Process in an operating systems sense • The composition of a process and how a process is scheduled in an operating system

1
Q

Operating system services

A
  • An operating system provides the environment within which programs
    are executed.
  • It provides certain services to programs and to the users of those
    programs. The specific services provided differ from one operating
    system to another, but there are common classes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Types of Operating system services

A

User interface
Program execution
I/O operations
File-system manipulation
Communications
Error detection.
Resource allocation
Accounting
Protection and security

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Operating system services User interface

A
  • Almost all operating systems have a user interface (UI). Can have a command-
    line interface (CLI), a batch interface, and/or a graphical user interface (GUI)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Operating system services Program execution

A
  • The system must be able to load a program into memory and to run that
    program. The program must be able to end its execution, either normally or
    abnormally (indicating error)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Operating system services

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Operating system service I/O operations

A
  • A running program may require I/O, which may involve a file or an I/O device
    (e.g. screen, DVD, etc.). Users usually cannot control I/O devices directly.
    Therefore, the operating system must provide a means to do I/O.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Operating system services File-system manipulation

A
  • Programs need to read and write files and directories. They also need to create
    and delete them by name, search for a given file, and list file information.
    Finally, some operating systems include permissions management to allow or
    deny access to files or directories based on file ownership
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Operating system services Communications

A
  • There are many circumstances in which one process needs to exchange
    information with another process. Such communication may occur between
    processes that are executing on the same computer or between processes that
    are executing on different computer systems tied together by a computer
    network. Communications may be implemented via shared memory, in which
    two or more processes read and write to a shared section of memory, or
    message passing, in which packets of information in predefined formats are
    moved between processes by the operating system.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Operating system services Error detection

A
  • The operating system needs to detect and correct errors constantly. Errors may
    occur in the CPU and memory hardware (such as a memory error or a power
    failure), in I/O devices (such as a parity error on disk, a connection failure on a
    network, or lack of paper in the printer), and in the user program (such as an
    arithmetic overflow, an attempt to access an illegal memory location, or a too-
    great use of CPU time). Correction might involve halting the system or
    terminating a process
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Operating system services Resource allocation

A
  • When there are multiple users or multiple jobs running at the same time,
    resources must be allocated to each of them. The operating system manages
    many different types of resources. Some (such as CPU cycles, main memory, and
    file storage) may have special allocation code, whereas others (such as I/O
    devices) may have much more general request and release code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Operating system services Accounting

A
  • We want to keep track of which users use how much and what kinds of
    computer resources.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Operating system services: Protection and security.

A
  • The owners of information stored in a multiuser or networked computer system
    may want to control use of that information. When several separate processes
    execute concurrently, it should not be possible for one process to interfere with
    the others or with the operating system itself. Protection involves ensuring that
    all access to system resources is controlled. Security involves securing the
    system from outsiders, i.e. requiring users to authenticate themselves.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

User Interface – command
interpreter

A
  • CLI or command interpreter allows direct command entry.
  • Sometimes implemented in kernel, sometimes by systems
    program
  • Sometimes multiple types implemented as shells
  • Primarily fetches a command from user and executes it
  • Sometimes commands built-in, sometimes just names of
    programs
  • Can use shell scripting to produce useful OS programs (Batch
    Files)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

User Interface – batch files

A

Collections of CLI commands run together to do
various tasks

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

User Interface – GUI

A
  • Graphical User Interface (GUI)
  • User-friendly desktop metaphor interface
  • Usually mouse, keyboard, and monitor
  • Icons represent files, programs, actions, etc.
  • Various mouse buttons over objects in the interface cause various
    actions (provide information, options, execute function, open
    directory (known as a folder)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Program Execution and System
Calls

A
  • Program execution - The system must be able to load a
    program into memory and to run that program, end
    execution, either normally or abnormally (indicating error)
  • Programming interface to the services provided by the OS
  • Typically written in a high-level language
  • Mostly accessed by programs via a high-level Application
    Programming Interface (API) rather than direct system call
    use
  • Three most common APIs are Win32 API for Windows,
    POSIX API for POSIX-based systems (including virtually all
    versions of UNIX, Linux, and Mac OS X), and Java API for the
    Java virtual machine (JVM)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What actually happens when a System
Program Makes a System Call?

A
  • Typically the OS associates a number with each system call
  • System-call interface maintains a table indexed according to these
    numbers
  • The system call interface invokes the intended system call in the OS
    kernel and returns status of the system call and any return values
  • The caller needs know nothing about how the system call is
    implemented
  • Just needs to obey API and understand what OS will do as a result
    call
  • Most details of OS interface hidden from programmer by API
  • Managed by run-time support library (set of functions built into
    libraries included with compiler)
  • Parameters passing
  • Use registers, table/memory block or the stack
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Types of System Calls

A
  • Process control
  • File management
  • Device management
  • Information maintenance
  • Communications
19
Q

Types of System Calls Process control

A
  • create process, terminate process, end, abort, load, execute, etc
20
Q

Types of System Calls File management

A
  • create file, delete file, open, close file, etc
21
Q

Types of System Calls Device management

A
  • request device, release device, read, write, etc
22
Q

Types of System Calls Information maintenance

A

get time or date, set time or date, get system data, set system data,
etc

23
Q

Types of System Calls Communications

A

create, delete communication connection, send & receive message

24
Q

System programs

A
  • Also known as system utilities. Basically, they provide a convenient
    environment for program development and execution.
  • Some of them are simply user interfaces to system calls.
  • Other are more complex, e.g. device driver
25
Q

System programs categories

A
  • Also known as system utilities. Basically, they provide a convenient
    environment for program development and execution.
  • Some of them are simply user interfaces to system calls.
  • Other are more complex, e.g. device driver
26
Q

System programs categories

A

File management.
Status information.
File modification
Programming-language support.
Program loading and execution
Communications
Background services.

27
Q

System programs categories File management

A
  • These programs create, delete, copy, rename, print, dump, list, and generally manipulate files and
    directories.
28
Q

System programs categories Status information

A
  • Some programs simply ask the system for the date, time, amount of available memory or disk
    space, number of users, or similar status information. Others are more complex, providing
    detailed performance, logging, and debugging information
29
Q

System programs categories File modification

A
  • Text editors and file content search/text transformations, et
30
Q

System programs categories Communications

A
  • These programs provide the mechanism for creating virtual connections among processes, users,
    and computer systems. They allow users to send messages to one another’s screens, to browse
    Web pages, to send e-mail messages, to log in remotely, or to transfer files from one machine to
    another.
30
Q

System programs categories Program loading and execution

A
  • Once a program is assembled or compiled, it must be loaded into memory to be executed…
    loaders, linkers, debuggers, etc
30
Q

System programs categories Programming-language support

A

Compilers, assemblers, debuggers, and interpreters for common programming languages (such as
C, C++, Java, and PERL)

31
Q

System programs categories Background services

A
  • All general-purpose systems have methods for launching certain system-program processes at
    boot time. Some of these processes terminate after completing their tasks, while others continue
    to run until the system is halted. Constantly running system-program processes are known as
    services, subsystems, or daemons. Include schedulers, system monitors, printer servers, et
32
Q

Process management overview

A
  • A process is essentially a program while being executed.
  • It needs certain resources (i.e. CPU time, memory, files, and I/O devices)
    to accomplish its task. These resources are allocated to the process
    either when it is created or while it is executing.
  • It is the unit of work in most systems. Systems consist of a collection of
    processes i.e. operating-system processes execute system code, and
    user processes execute user code. All these processes may execute
    concurrently.
  • Traditionally a process contained only a single thread of control as it ran.
    Now, most modern operating systems support processes that have
    multiple threads.
  • The operating system is responsible for several important aspects of
    process and thread management, such as:
  • The creation and deletion of both user and system processes;
  • The scheduling of processes; and
  • The provision of mechanisms for synchronisation, communication, and
    deadlock handling
33
Q
  • What is a process?
A

Jobs, user programs, operating system programs, tasks,
unit of work, etc.

33
Q

What is a Process made of?

A

Text
Stack
Data
Heap

33
Q

What is a Process made of? Text

A
  • Program code + current activity status
    (value of the program counter and
    processors’ (CPU, etc.) registers
33
Q

What is a Process made of?Stack

A
  • Temporary data (such as function
    parameters, return addresses, local
    variables, etc.)
34
Q

What is a Process made of?Data

A
  • Global variables
35
Q

What is a Process made of?* Heap

A
  • Memory is dynamically allocated during
    process run time
  • 0… Max denote memory allocated for the
    process
36
Q

Process state

A
  • As a process executes, it changes state.
  • New. The process is being created
  • Running. Instructions are being executed
  • Waiting. The process is waiting for some event to occur (such as an
    I/O completion or reception of a signal)
  • Ready. The process is waiting to be assigned to a processor
  • Terminated. The process has finished execution
    (These names are arbitrary, and they vary across operating systems)
  • Only one process can be Running at any time
  • Many processes can be Ready and Waiting
37
Q

Process Control Block

A

Process state (New, ready, running, waiting, etc.)

Program counter (The counter indicates the address of the next
instruction to be executed for this process)

CPU registers (The registers vary in number and type, depending
on the computer architecture. They include accumulators, index
registers, stack pointers, and general-purpose registers, plus any
condition-code information)

CPU-scheduling information (This information includes process
priority, pointers to scheduling queues, and any other scheduling
parameters)

Memory-management information (This information may
include such items as the value of the base and limit registers and
the page tables, or the segment tables, depending on the memory
system used by the operating system)

Accounting information (This information includes the amount of
CPU and real time used, time limits, account numbers, job or process
numbers, and so on)

I/O status information (This information includes the list of I/O
devices allocated to the process, a list of open files, and so on)

38
Q

Process Scheduling

A
  • The process scheduler is responsible for choosing and running processes
  • When a process is allocated, the CPU it executes for a while and eventually
    quits, is interrupted, or waits for the occurrence of a particular event, such
    as the completion of an I/O request.
  • The process scheduler needs a job queue, a ready queue, a device queue
    and others (we will worry about the first three)
  • Job queue
  • Consists of all processes in the system.
  • Ready queue
  • Processes that are residing in main memory and are ready and waiting to
    execute
  • Device queue
  • A process wishes to make an I/O request to a shared device (e.g. disk, screen,
    keyboard, printer, drone, killer penguin, etc.) The device might be busy dealing
    with another process’ I/O request.
  • A device queue is therefore the list of processes waiting to use that device.
  • Queues are generally stored as a linked list
  • E.g. a ready-queue header contains pointers to the first and final PCBs in the
    list. Each PCB includes a pointer field that points to the next PCB in the ready
    queue.
39
Q

Schedulers

A
  • Short-term scheduler (or CPU scheduler)
  • Selects which process should be executed next and allocates CPU
  • Sometimes the only scheduler in a system
  • Short-term scheduler is invoked frequently (milliseconds)  (must be
    fast)