ertos u4 notes

14
OPERATING SYSTEM BASICS An OS is system software that manages computer hardware and software resources and provides common services for computer programs. The operating system is an essential component of the system software in a computer system. Application usually requires an operating system to function. Time-sharing operating systems schedule tasks for efficient use of the system and may also include accounting software for cost allocation of processor time, mass storage, printing, and other resources. For hardware functions such as input and output and memory allocation, the operating system acts as an intermediary between programs and the computer hardware, although the application code is usually executed directly by the hardware and frequently makes system calls to an OS function or be interrupted by it. Operating systems are found on many devices that contain a computer—from cellular phones and video game consoles to web servers and supercomputers. Examples: popular modern operating systems include 1. Android 2. BlackBerry 3. BSD 4. Chrome OS 5. iOS 6. Linux 7. OS X 8. QNX

Upload: muppala-chiranjeevi

Post on 07-Dec-2015

126 views

Category:

Documents


13 download

DESCRIPTION

4-1 jntu A ERTOS NOTES

TRANSCRIPT

Page 1: Ertos u4 Notes

OPERATING SYSTEM BASICS

An OS is system software that manages computer hardware and software resources and provides common services for computer programs. The operating system is an essential component of the system software in a computer system. Application usually requires an operating system to function.

Time-sharing operating systems schedule tasks for efficient use of the system and may also include accounting software for cost allocation of processor time, mass storage, printing, and other resources.

For hardware functions such as input and output and memory allocation, the operating system acts as an intermediary between programs and the computer hardware, although the application code is usually executed directly by the hardware and frequently makes system calls to an OS function or be interrupted by it. Operating systems are found on many devices that contain a computer—from cellular phones and video game consoles to web servers and supercomputers.

Examples:

popular modern operating systems include 

1. Android2.  BlackBerry3.  BSD4. Chrome OS5.  iOS6.  Linux7.  OS X8. QNX9. Microsoft Windows10.  Steam OS11. Windows Phone12.  z/OS.

The first eight of these examples share roots in UNIX.

Popular hard real-time operating systems include FreeRTOS, Micrium and VxWorks.

Page 2: Ertos u4 Notes

The Kernel

The kernel is the core of an operating system. It is the software responsible for running programs and providing secure access to the machine's hardware. Since there are many programs, and resources are limited, the kernel also decides when and how long a program should run. This is called scheduling. Accessing the hardware directly can be very complex, since there are many different hardware designs for the same type of component.

Kernels usually implement some level of hardware abstraction (a set of instructions universal to all devices of a certain type) to hide the underlying complexity from applications and provide a clean and uniform interface. This helps application programmers to develop programs without having to know how to program for specific devices. The kernel relies upon software drivers that translate the generic command into instructions specific to that device.

Four broad categories of kernels: Monolithic kernels provide rich and powerful abstractions of the underlying hardware. Microkernel provide a small set of simple hardware abstractions and use applications called

servers to provide more functionality. Exokernels provide minimal abstractions, allowing low-level hardware access. In exokernel

systems, library operating systems provide the abstractions typically present in monolithic kernels.

Hybrid (modified microkernels) are much like pure microkernels, except that they include some additional code in kernel space to increase performance.

Page 3: Ertos u4 Notes

Types of Operating SystemsFollowing are some of the most widely used types of Operating system.

1. Simple Batch System2. Multiprogramming Batch System3. Multiprocessor System4. Distributed Operating System5. Realtime Operating System

SIMPLE BATCH SYSTEMS

In this type of system, there is no direct interaction between user and the computer.

The user has to submit a job (written on cards or tape) to a computer operator.

Then computer operator places a batch of several jobs on an input device.

Jobs are batched together by type of languages and requirement.

Then a special program, the monitor, manages the execution of each program in the batch.

The monitor is always in the main memory and available for execution.

Following are some disadvantages of this type of system :

1. Zero interaction between user and computer.

2. No mechanism to prioritize processes.

MULTIPROGRAMMING BATCH SYSTEMS

In this the operating system, picks and begins to execute one job from memory. Once this job needs an I/O operation operating system switches to another job (CPU and OS

always busy).Jobs in the memory are always less than the number of jobs on disk(Job Pool). If several jobs are ready to run at the same time, then system chooses which one to run (CPU

Scheduling).

Page 4: Ertos u4 Notes

In Non-multiprogrammed system, there are moments when CPU sits idle and does not do any work.

In Multiprogramming system, CPU will never be idle and keeps on processing.

Time-Sharing Systems are very similar to Multiprogramming batch systems. In fact time

sharing systems are an extension of multiprogramming systems.

In time sharing systems the prime focus is on minimizing the response time, while in

multiprogramming the prime focus is to maximize the CPU usage.

MULTIPROCESSOR SYSTEMS

A multiprocessor system consists of several processors that share a common physical memory.

Multiprocessor system provides higher computing power and speed. In multiprocessor system all

processors operate under single operating system. Multiplicity of the processors and how they do

act together are transparent to the others.

Following are some advantages of this type of system.

1. Enhanced performance2. Execution of several tasks by different processors concurrently, increases the system's

throughput without speeding up the execution of a single task.3. If possible, system divides task into many subtasks and then these subtasks can be executed

in parallel in different processors. Thereby speeding up the execution of single tasks.

DISTRIBUTED OPERATING SYSTEMS

The motivation behind developing distributed operating systems is the availability of powerful

and inexpensive microprocessors and advances in communication technology.

These advancements in technology have made it possible to design and develop distributed

systems comprising of many computers that are inter connected by communication networks.

The main benefit of distributed systems is its low price/performance ratio.

REAL-TIME OPERATING SYSTEM

It is defined as an operating system known to give maximum time for each of the critical

operations that it performs, like OS calls and interrupt handling.The Operating system which

guarantees the maximum time for these operations are commonly referred to as hard real-time,

hile operating systems that can only guarantee a maximum of the time are referred to as soft

real-time.

Page 5: Ertos u4 Notes

TASKS, PROCESS AND THREADS

PROCESS

Structure of a Process

Page 6: Ertos u4 Notes
Page 7: Ertos u4 Notes

THREADS

A thread is the smallest unit of processing that can be performed in an OS. An execution state (running, ready, etc.) Has an execution stack. In most modern operating systems, a thread exists within a process - that is, a single

process may contain multiple threads. On a single processor, multi threading generally occurs by as in multitasking, the

processor switches between different threads.

This context switching generally happens frequently enough that the user perceives the threads or tasks to be running at the same time.

On the multiprocessor or mutli-core system, the threads or task actually do run at the same time, with each processor or core running a particular thread or task.

THREAD STATES

Three key states: running, ready, blocked

Single and Multithreading Processes

Page 8: Ertos u4 Notes

No suspend state since all threads share the same address space.

Suspending a process involves suspending all threads of the process.

Termination of a process, terminates all threads within the process.

States associated with a change in thread state:

i. Spawn -spawn another thread

ii. Block

iii. Unblock

iv. Finish

Types Of Threads

1. User Level Threads – (user managed thread)

2. Kernel-Level Threads

1.User Level Threads – (user managed thread)

All thread management is done by the application.

The kernel is not aware of the existence of threads.

OS only schedules the process, not the threads within process.

Programmer using a thread library to manage threads (create,delete,schedule)

Diagram Of User-level Thread

2. Kernel/System-Level Threads

All thread management is done by the kernel.

Kernel maintains context information for the process and the threads.

No thread library but an API to the kernel threads facility.

Switching between threads requires the kernel.

Scheduling is done on a thread basis.

Page 9: Ertos u4 Notes

Multithreading Models

1. Many to One Relationship

Many user-level threads mapped to single kernel threads.

2. Many to Many Relationship

Allows many user level threads to be mapped to many kernel threads.

Allows the operating system to create a sufficient number of kernel threads.

User Level Threads Kernel Level Thread

Faster to create and manage. Slower to create and manage.

Implementation is by a thread library at the user level.

OS supports creation of kernel thread.

Generic and can run on any OS. Specific to the OS.

Multi-threaded application can not take advantage of multiprocessing.

Kernel routines themselves can be multithreaded.

Page 10: Ertos u4 Notes

3. One to One Relationship

Each user-level thread maps to kernel threads.

Allow another threads to run if block.

Run parallel

MULTIPROCESSING AND MULTITASKING

MULTIPROCESSING