33
Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer Galvin, Greg –Alternative Textbook: Operating systems : internals and design principles by William Stallings.

Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Embed Size (px)

Citation preview

Page 1: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Operating Systems66451 Fall 2013

Luai Malhis, Ph.D

• Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer Galvin, Greg –Alternative Textbook:Operating systems : internals and design principles by William Stallings.

Page 2: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Course Objectives• Distinguish between the different types of

operating systems• Identify the different components of operating

system and their functions.• Analyze in details:

Processes and threadsConcurrency controlMemory managementDeadlockFile System

Page 3: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Grading policy

• Midterm I 20%• Midterm II 20%• Homework 10%• Final Exam 50%

Page 4: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

What is an Operating System?• The operating system (OS) is the program which

starts up when you turn on your computer and runs underneath all other programs - without it nothing would happen at all.

• In simple terms, an operating system is a manager. It manages all the available resources on a computer, from the CPU, to memory, to hard disk accesses.

• An interface between applications and hardware

Page 5: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Operating system functions• Tasks the operating system must perform:– Control Hardware - The operating system controls

all the parts of the computer and attempts to get everything working together.

– Run Applications - Another job the OS does is run application software. This would include word processors, web browsers, games, etc...

– Manage Data and Files - The OS makes it easy for you to organize your computer. Through the OS you are able to do a number of things to data, including copy, move, delete, and rename it. This makes it much easier to find and organize what you have.

– Provide services to users and applications

Page 6: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Operating System Objectives• Convenience– Makes the computer more convenient to use

• Efficiency– Allows computer system resources to be used in

an efficient manner• Ability to evolve– Permit effective development, testing, and

introduction of new system functions without interfering with service

Page 7: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Layers of Computer System

Page 8: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Services Provided by the Operating System

• Program development– Editors and debuggers

• Program execution• Access to I/O devices• Controlled access to files• System access

Page 9: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Services Provided by the Operating System

• Error detection and response– internal and external hardware errors• memory error• device failure

– software errors• arithmetic overflow• access forbidden memory locations

– operating system cannot grant request of application

Page 10: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Services Provided by the Operating System

• Accounting– collect statistics– monitor performance– used to anticipate future enhancements– used for billing users

Page 11: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

• Multiprogramming: Overlap IO and CPU execution• Time Sharing - multiprogramming environment with multiple users.• Multiprocessing - Tightly coupled systems that communicate via shared memory. Used for

scientific applications. Used for speed improvement by putting together a number of off-the-shelf processors.

• Distributed Systems - Loosely coupled systems that communicate via message passing. Advantages include resource sharing, speed up, reliability, communication.

• Real Time Systems - Rapid response time is main characteristic. Used in control of applications where rapid response to a stimulus is essential.

1: Operating Systems Overview 11

Types of Operating systems

Page 12: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Uniprogramming

• Processor must wait for I/O instruction to complete before preceding

Page 13: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Multiprogramming

• When one job needs to wait for I/O, the processor can switch to the other job

Page 14: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Multiprogramming

Page 15: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Multiprogramming Improves resource utilization and system performance

Uniprogramming Multiprogramming

Processor use 22% 43%

Memory use 30% 67%

Disk use 33% 67%

Printer use 33% 67%

Elapsed time 30 min. 15 min.

Throughput rate 6 jobs/hr 12 jobs/hr

Mean response time 18 min. 10 min.

Page 16: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Time Sharing• Using multiprogramming to handle multiple

interactive jobs• Processor’s time is shared among multiple

users• Multiple users simultaneously access the

system through terminals• Windows is a multiprogramming system while

unix (linux) is a time sharing system

Page 17: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Characteristics of Modern Operating Systems

• Microkernel architecture– assigns only a few essential functions to the kernelThe Kernel in the Main part of the OS that always

reside in memory and it handles:• address space manipulation• interprocess communication (IPC)• basic scheduling• Basic Memory management• Basic disk management

Page 18: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Characteristics of Modern Operating Systems

• Multithreading– process is divided into threads that can run

simultaneously

A Thread is : • dispatchable unit of work• executes sequentially and is interruptable• A Process is a collection of one or more threads

Page 19: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Multi-processing system

• Symmetric multiprocessing– there are multiple processors– these processors share same main memory and I/O

facilities• All processors can perform the same functions• Different routines can execute simultaneously on

different processors• Multiple threads of execution within a single

process may execute on different processors simultaneously

• Server processes may use multiple threads

Page 20: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Distributed operating systems

• Characteristics– provides the illusion of a single main memory and

single secondary memory space– used for distributed file system– Sharing resources

Page 21: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

OPERATING SYSTEM STRUCTURES

2: OS Structures 21

A LAYERED STRUCTURE: Example of UNIX.

How An Operating System Is Put Together

Page 22: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

UNIX

Page 23: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

OPERATING SYSTEM STRUCTURES

2: OS Structures 23

• In a Virtual Machine - each process "seems" to execute on its own processor with its own memory, devices, etc.

· The resources of the physical machine are shared. Virtual devices are sliced out of the physical ones. Virtual disks are subsets of physical ones.

· Useful for running different OS simultaneously on the same machine.

· Protection is excellent, but no sharing possible.· Virtual privileged instructions are trapped.

Virtual Machine

Page 24: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

O.S. History

Simple Batch System (mid 1950s)· Try to improve scheduling/setup time· Have a monitor that loads jobs, when a job finishes it

jumps to the monitor that loads the next job.· Use JCL (Job Control Language) to submit jobs

· Desirable hardware items:• Memory protection• Timer• Privileged instructions (I/O)• Interrupts

• Multiprogrammed Batch System· Several programs in memory at one time

· One program can do I/O while another computes· Needs memory management, scheduling

Page 25: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Time-Sharing Systems

• Allow several users to interact with the system at the same time• Emphasizes response time over processor use• Compatible time sharing system (CTSS) – 1962

· Machine had 32K 32-bit words· Switched users every 0.2 second· Supported up to 32 users

• MULTICS (1965): Originally it was a cooperative project led by MIT along with General Electric and Bell Labs

· Strong influence on later systems· Good security, user interface

• Note systems tend to grow over time as user requirements expand– MS-DOS 1.0 (8k, 1981)– DOS 2.0 – Subdirectories (1983)– DOS 3.1 – Networking (1984)– Windows 3.1 – Graphical interface (1990)– Windows 95 – 32-bit internals (1995)

• Single-user multitasking (windows 95)

Page 26: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Modern Systems

• Windows 2000 and beyond – Single-user multitasking

• One user running multiple programs– Uses client/server model, objects– Supports threads and SMP

• Unix– Created for PDP-7 (1970), PDP-11

• Used ideas from MULTICS, CTSS– Rewritten in C, source was available

• Easy to port to new systems– SVR4, Solaris 2.x, 4.4 BSD– Linux

• Derived from Minix by Linus Torvalds• Handled by volunteers• Monolithic kernel

– Can load/unload kernel modules

Page 27: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

The Mac OS x

• OS X (ROMAN 10), previously Mac OS X, is a series of Unix-based graphical interface operating systems developed, marketed, and sold by Apple Inc. It is designed to run exclusively on Mac computers.

• OS X originally ran on PowerPC-based Macs. In 2006, the first Intel Macs had a specialized version "Tiger".

• OS X is based upon the Mach kernel. Certain parts from FreeBSD's of Unix were incorporated in NeXTSTEP, the core of Mac OS X. NeXTSTEP was the graphical, object-oriented, and UNIX-based operating system developed by Steve Jobs' company NeXT after he left Apple in 1985.

• In 2012, with the release of OS X 10.8, the "Mac" prefix was officially dropped in all references to the operating system name.

Page 28: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Advantages of Unix• Unix is more flexible and can be installed on many different types of

machines, including main-frame computers, supercomputers and micro-computers.

• Unix is more stable and does not go down as often as Windows does, therefore requires less administration and maintenance.

• Unix has greater built-in security and permissions features than Windows.

• -Unix possesses much greater processing power than Windows.

• - Unix is the leader in serving the Web. About 90% of the Internet relies on Unix operating systems running Apache, the world's most widely used Web server.

Page 29: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Advantages Continue• Software upgrades from Microsoft often require the user to

purchase new or more hardware or prerequisite software. That is not the case with Unix.

• The mostly free or inexpensive open-source operating systems, such as Linux and BSD, with their flexibility and control, are very attractive to (aspiring) computer wizards. Many of the smartest programmers are developing state-of-the-art software free of charge for the fast growing "open-source movement”.

• Unix also inspires novel approaches to software design, such as solving problems by interconnecting simpler tools instead of creating large monolithic application programs.

Page 30: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

The Linux Operating System • The student, Linus Torvalds, was experimenting with Minix, a free Unix OS for PCs, developed

by Andrew S. Tanenbaum from Amsterdam, The Netherlands. Linus wanted to develop a Unix OS for his PC that overcame the limitations of Minix. It just so happened that the PC architecture, for which he developed his new and improved Unix OS, would evolve into the world’s most successful line of computers. This formed the basis for Linux’s rapidly growing popularity. Linus’ talent and hard work and the support from the open source community did the rest.

• During the second half of 1991, the unthinkable started to become reality when Linus made version 0.02 of what would become known as "Linux" ("Linus' Unix") available to the open source community. By 1994 he was ready to release the first stable Linux Kernel (version 1.0) to the world. Once it was out, it quickly spread, gained power and evolved into a variety of species ("distributions"). Today, there are an estimated 29 Million Linux users; many of them actively involved in developing software for it and continuing development of the kernel.

• One of the reasons of Linux’s popularity stems from the license under which it was released, the GNU General Public License . It ensures that the Linux source code is freely available to everyone, and everyone can contribute to its development. This effectively added thousands of programmers to the Linux development team.

Page 31: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Linux Advantages • Low cost: You don’t need to spend time and money to obtain licenses

since Linux and much of its software come with the GNU General Public License.

• Stability: Linux doesn’t need to be rebooted periodically to maintain performance levels. It doesn’t freeze up or slow down over time.

• Performance: Linux provides persistent high performance. It can handle unusually large numbers of users simultaneously, and can make old computers sufficiently responsive to be useful again.

• Network friendliness: Linux was developed by a group of programmers over the Internet and has therefore strong support for network functionality; client and server systems can be easily set up on any computer running Linux.

Page 32: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Linux Advantages continue• Flexibility: Linux can be used for high performance server

applications, desktop applications, and embedded systems.

• Compatibility: It runs all common Unix software packages and can process all common file formats.

• Choice: The large number of Linux distributions gives you a choice. Each distribution is developed and supported by a different organization. You can pick the one you like best.

• Fast and easy installation: Most Linux distributions come with user-friendly installation and setup programs. Popular Linux distributions come with tools that make installation of additional software very user friendly as well.

Page 33: Operating Systems 66451 Fall 2013 Luai Malhis, Ph.D Required Textbook: Operating System Concepts, Seventh Edition, By Abraham Silberschatz, Peter Baer

Linux Advantages continue• Full use of hard disk: Linux continues work well even when the hard

disk is almost full.

• Multitasking: Linux is designed to do many things at the same time; e.g., a large printing job in the background won’t slow down your other work.

• Security: Linux is one of the most secure operating systems. “Walls” and flexible file access permission systems prevent access by unwanted visitors or viruses.

• Open Source: If you develop software that requires knowledge or modification of the operating system code, Linux’s source code is at your fingertips. Most Linux applications are Open Source as well.