39
CSC322 OPERATING SYSTEM Mr. Dilawar Lecturer, Department of Computer Science, Rana University Kabul, Afghanistan.

OPERATING SYSTEM - LECTURE 01

Embed Size (px)

Citation preview

Page 1: OPERATING SYSTEM - LECTURE 01

CSC322OPERATING SYSTEM

Mr. Dilawar

Lecturer,Department of Computer Science,

Rana UniversityKabul, Afghanistan.

Page 2: OPERATING SYSTEM - LECTURE 01

Course ObjectivesAfter successfully completing this course, you will be able to: • Understanding the fundamentals of Operating System.• Understand the concept of Process and Threads.• Understand the concept of CPU Scheduling.• Know what deadlocks in OS are?• Familiarize with Storage Management and File systems.• And much more…

Page 3: OPERATING SYSTEM - LECTURE 01

Course Outline• Introduction to OS concepts

• Processes

• CPU Scheduling

• Deadlocks

• Main Memory and Virtual Memory

• Storage Management

Page 4: OPERATING SYSTEM - LECTURE 01

Text Books to Follow• Operating System Concepts, Abraham Silberschatz, and Peter B.

Galvin 9th Edition.

• Modern Operating System, Andrew S. Tanenbaum, 4th Edition

Page 5: OPERATING SYSTEM - LECTURE 01

IntroductionChapter – 1

Page 6: OPERATING SYSTEM - LECTURE 01

Lecture Outline• What is OS and what is can do?

• Computer system organization

• Computer system architecture

• Operating system structure

• Operating system operations

Page 7: OPERATING SYSTEM - LECTURE 01

What is an Operating System?• A program that acts as an intermediary between a user of a computer

and the computer hardware.`

• An operating system is a software that manages the computer hardware and provides basis for application programs.

• The main goals of operating system are:• Execute user programs and make solving user problems easier.• Make the computer system convenient to use.• Use the computer hardware in an efficient manner.

Page 8: OPERATING SYSTEM - LECTURE 01

Components of Computer System• Hardware – provides basic computing resources

• CPU, memory, I/O devices

• Operating system• Controls and coordinates use of hardware among various applications and users

• Application programs – define the ways in which the system resources are used to solve the computing problems of the users• Word processors, compilers, web browsers, database systems, video games

• Users• People, machines, other computers

Page 9: OPERATING SYSTEM - LECTURE 01

Components of Computer System

Page 10: OPERATING SYSTEM - LECTURE 01

What Operating Systems Can Do?• Operating system is like government.

• The operating system can be viewed from two points:• User Point of view• System Point of view

Page 11: OPERATING SYSTEM - LECTURE 01

What Operating Systems Can Do?• User Point of View• Ease of Use – OS is a program that provides easy user friendly interface for

the user to interact with the hardware of computer.• Resource utilizer – Describes how various hardware and software resources

are shared and consumed.

Page 12: OPERATING SYSTEM - LECTURE 01

What Operating Systems Can Do?• System Point of View• OS is a resource allocator.

• Manages all resources.

• Decides between conflicting requests for efficient and fair resources use.

• OS is a control program.• Controls execution of programs to prevent errors and improper use of the computer.

Page 13: OPERATING SYSTEM - LECTURE 01

What Operating Systems Can Do?• No universally accepted viewpoint of what is part of the OS.

• “Everything a vender ships when you order an operating system “ is good approximation.

• The one program running all times on the computer is called kernel.

• Everything else is either a system program (ships with the operating system) or application program.

Page 14: OPERATING SYSTEM - LECTURE 01

Computer System OrganizationComputer System Operation

• One or more CPUs and device controllers connected through bus providing access to the shared memory.

• The CPUs and device controllers are executed in parallel.

Page 15: OPERATING SYSTEM - LECTURE 01

Computer System OrganizationComputer System Operation

• Bootstrap program is load at power-up or reboot.

• It is stored in within the computer hardware in ROM or EPROM also known by the name of firmware.

• It initializes all aspects of the system, from CPU registers to device controllers to memory contents.

Page 16: OPERATING SYSTEM - LECTURE 01

Computer System OrganizationComputer System Operation

• The bootstrap must locates the OS kernel and load it into memory.

• After kernel starts, it can start provide services to system and its user.• Some services are provided outside of the kernel, by system programs that

are loaded into memory at boot time to become system process.• After the complete boots the system waits for some event to occur.

Page 17: OPERATING SYSTEM - LECTURE 01

Computer System OrganizationComputer System Operation

• Device controller informs CPU that it has finished its operation by causing an interrupt.

• An interrupt is a signal from a device controller or from a program that causes the CPU to stop and figure out what to do next.

• Interrupt transfers control to the interrupt service routine generally through the interrupt vector table, which contains the addresses of all the service routines.

Page 18: OPERATING SYSTEM - LECTURE 01

Computer System OrganizationComputer System Operation

• Incoming interrupts are disabled while another interrupt is being processed to prevent a lost interrupt.

• A trap is a software-generated interrupt (system call) caused either by an error or a user request.

Page 19: OPERATING SYSTEM - LECTURE 01

Computer System OrganizationComputer System Operation

• Interrupt handler specifies which type of interrupt has been occurred:• Polling – An interrupt in which the part/device is not specified.• Vectored – specified.

• An operating system is interrupt-driven.

Page 20: OPERATING SYSTEM - LECTURE 01

Computer System OrganizationStorage Structure

• Primary Memory – CPU loads instructions and can access directly.• RAM – Volatile memory• ROM – Non-Volatile memory

• The interaction is made through a sequence of load and store instruction.

• Secondary storage device – extension of main memory that provides large non-volatile storage capacity.• Magnetic disk is the most common type of the secondary storage device.

Page 21: OPERATING SYSTEM - LECTURE 01

Computer System OrganizationStorage Structure

• Storage system are organized in hierarchy:• Speed• Cost• Volatility

• Caching – Copying information into faster storage system; main memory can be viewed as a cache for secondary storage.

Page 22: OPERATING SYSTEM - LECTURE 01

Computer System OrganizationStorage Structure

Page 23: OPERATING SYSTEM - LECTURE 01

Computer System Architecture• We introduced the general structure of a typical computer system.

• Computers can categorized based on the number of general-purpose processors.

• Most computer systems today uses single-processor system.• There is only one CPU used for single-processor system.• They might have device-specific special microprocessors that helps in the

transmission of the data.

Page 24: OPERATING SYSTEM - LECTURE 01

Computer System Architecture• A computer system consist of two or more processors is called

multiprocessor system, parallel or multicore system.

• The advantages of these system are:• Increased throughput – efficiently doing work.• Economy of scale – better than having many computers.• Increased reliability – graceful degradation or fault tolerant.

Page 25: OPERATING SYSTEM - LECTURE 01

Computer System Architecture• Two types of multiprocessor system:• Asymmetric Multiprocessing System (AMP) – each processor is assigned

proper task.• Boss-worker relationships.

• Symmetric Multiprocessing System (SMP) – each processors performs all tasks within the operating system.

Page 26: OPERATING SYSTEM - LECTURE 01

Computer System Architecture• Multiprocessing can cause a system to change its memory access

model from UMA to NUMA.

• UMA stands for uniform memory access and it is a situation in which access to any RAM from any CPU takes the same amount of time.

• With NUMA, some parts of memory may take longer to access than other parts.

• Operating system can minimize NUMA through resource management.

Page 27: OPERATING SYSTEM - LECTURE 01

Computer System Architecture• Multi computing cores on a single chip–recent trend.

• On chip communication – Faster than between chip communication and usage of less power.

• Multicore systems are multiprocessor systems but not vice versa.

Page 28: OPERATING SYSTEM - LECTURE 01

Computer System Architecture• Clustered systems are like multiprocessor system, but multiple

systems working together.

• Usually sharing storage via a local area network.

• Provides a high availability service when a failure occurs.

Page 29: OPERATING SYSTEM - LECTURE 01

Computer System Architecture• There are two types of clustered systems:• Asymmetric clustering – has one machine in hot-standby mode that oversees

the active server if it fails so then he takes the functionality of the server.• Symmetric clustering – two or more hosts are running applications and

monitoring each other.

• Some clusters are used for providing high performance computing (HPC)• Application must be written to use parallelization.

Page 30: OPERATING SYSTEM - LECTURE 01

Operating System Structure• Provides environment where other programs are executed.

• Most important ability of OS is to multi-program.

• The concept of using multi-programs on the same time tells as that the OS supports multiprogramming.

• It increases CPU utilization so that the CPU always has one to execute.

Page 31: OPERATING SYSTEM - LECTURE 01

Operating System Structure• Jobs are initially kept on a disk – job pool.

• In non-multi-programmed, the CPU would sit idle due to some I/O but here it switches to another job.

• Lawyer is a good example of multi-programmed system.

Page 32: OPERATING SYSTEM - LECTURE 01

Operating System Structure• A time-shared is a multi-user, multi-process and interactive system.

• Allows user to interact and use the computer simultaneously.

• A time-shared system uses multiprogramming and CPU scheduling to provide each user with a small portion of a time-shared computer.

• A program that is loaded in to memory and executed is called process.

• If several jobs ready to run or to take placed in memory – CPU scheduling and job scheduling.

Page 33: OPERATING SYSTEM - LECTURE 01

Operating System Structure• If processes don’t fit in memory, swapping moves them in and out to

run.

• Virtual memory allows the execution of a process that is not completed in memory.

• The time shared OS provides a lot of facilities that will be covered later on.

Page 34: OPERATING SYSTEM - LECTURE 01

Operating System Operations• Modern OS are interrupt driven.

• It is a signal generated by a hardware device to get CPU’s attention.

• Software error or request create exception or traps.• Division by zero, request for OS service• Example of infinite loop.

• A properly designed operating system must ensure that an incorrect program cannot harm other programs.

Page 35: OPERATING SYSTEM - LECTURE 01

Operating System OperationsDual Mode Operations

• There are two modes of executions:• User Mode (1)• Kernel Mode (supervisor mode, system mode, or privileged mode) (0)

• A mode bit is added to the hardware of computer to checkout the correct modes.

• Computer is executing on behalf of user a user application – user mode.

• Requests a service from operating system – move to kernel mode.

Page 36: OPERATING SYSTEM - LECTURE 01

Operating System OperationsDual Mode Operations

• Dual boot operation allows OS to protect itself and other system components.

Page 37: OPERATING SYSTEM - LECTURE 01

Operating System OperationsTimer

• A timer, can be set to interrupt the computer after a specified period.

• We can use the timer to prevent a user program from running too long.

Page 38: OPERATING SYSTEM - LECTURE 01

Summery• What is OS and what is can do?

• Computer system organization

• Computer system architecture

• Operating system structure

• Operating system operations

Page 39: OPERATING SYSTEM - LECTURE 01

Thank YouFor your Patience