Académique Documents
Professionnel Documents
Culture Documents
A program that manage computer hardware. OR we can say that Operating system is an intermediary between the user and computer hardware.
Computer-System Architecture
Operating systems have been evolving through the years. since operating systems historically have been closely tied to the architecture of the computers on which they run.
Shell
A peace of software provide interface for user.
file system
allowing files to be recorded in a tree structure.
OS operations
Process management
y A process is a program in execution. give a work to computer to process it) It is a
OS operations continue
Memory Management(OS)
y y y
All data in memory before and after processing All instructions in memory in order to execute Memory management determines what is in memory when optimizing CPU utilization and computer response to users
OS operations continue
Storage Management
y y
OS provides uniform, logical view of information storage Each medium is controlled by device (i.e., disk drive, tape drive)
OS operations continue
File-System management
y y
Files usually organized into directories Access control on most systems to determine who can access what(secutiry in operating system) Creating and deleting files and directories Mapping files onto secondary storage Backup files onto stable (non-volatile) storage media
y y y
10
What is OS process?
A process is just an executing In running condition . Program, including the current values of the program counter, registers, and variables. In other word giving a task to the CPU is called processing.. Q:then we can say that material on the hard disk is being process? Ans:: the material in hard disk is not a process...
11
Time-shared systems
It will share the job in period of time.
12
A process includes:
Program counter
Are the CPU free or not...
Stack
how many processes the CPU have now
Data section
What type information the CPU has...
13
14
Process state Program counter CPU registers Input output status CPU scheduling information Memory-management information Accounting information
15
Job queue
Ready queue
Device queues
16
Schedulers
selects which processes should be brought into the ready queue. Long-term scheduler is invoked very infrequently (seconds, minutes) (may be slow).
Short-term scheduler
(or CPU scheduler) selects which process should be executed next and allocates CPU. Short-term scheduler is invoked very frequently (milliseconds) (must be fast).
The key idea behind a medium term scheduler is that Sometimes it can be advantageous to remove processes from memory to reduce the degree of multiprogramming. After some time the process can be introduced into memory and its execution can be continued where it left off. This scheme is called swapping...
17
Process operations
the processes in the system can execute concurrently and must be created and deleted dynamically. Thus, the operating system must provide a mechanism for process creation and termination.
18
19
CPU SCEDULING
THE QUESTION DOES ARRIES??????? We have a single physical CPU and a lot of processes/jobs to run Which process do we run next? For how long do we run it?
20
Basic Concepts
y Maximum CPU utilization obtained with multiprogramming y CPU I/O Burst Cycle
process requires the cpu between I/O waits. It can not be predicted exactly, before a process starts.
21
CPU Scheduler
When ever the cpu become idle, the operating system must select one of the processes in the ready queue not the FIFO) to be executed. the selection process is carried out by the Short-term scheduler .the scheduler selects from among the processes in memory that are ready to execute, and allocated the cpu to one of them.
22
y Preemptive
if a new process arrives with CPU burst length less than remaining time of current executing process, preempt. This scheme is know as the Shortest-Remaining-Time-First (SRTF). y Switches from running to ready state. y Switches from waiting to ready.
23
Dispatcher
Another component involved in the CPU scheduling function is the dispatcher is the module that gives control of the CPU to the process selected by the short-term scheduler; this involves:
1. 2. 3.
switching context switching to user mode jumping to the proper location in the user program to restart that program Dispatch latency time it takes for the dispatcher to stop one process and start another running.
24
Throughput
processes that complete their execution per time unit
Turnaround time
the interval from the time of submission of a process to the time of completion is the turnaround time. Turnaround time is the sum of the periods spent waiting to get into memory, waiting in the ready queue, executing on the CPU,and doing i/o.
Waiting time
amount of time a process has been waiting in the ready queue
Response time
amount of time it takes from when a request was submitted until the first response is produced, not output (for time-sharing environment)
25
Scheduling Algorithms
CPU scheduling deals with which of the processes in allocated the CPU. There scheduling algorithms. Here one the problems of deciding the ready queue is to be are many different CPU we will describe it one by
26
Process Burst Time First-Come, First-Served 24 (FCFS) Scheduling P1 P2 3 P3 3 Suppose that the processes arrive in the order: P1 , P2 , P3 Waiting time for P1 = 0; P2 = 24; P3 = 27 Advantage Its is fair scheduling Disadvantage short jobs have to wait for longer jobs
27
Shortest-Job-First (SJR)
Process Burst Time P1 24 P2 3 P3 7 the processes will be arrive in the order: P2 , P3 , P1 Waiting time for P2 = 0; P3 = 3; P3 = 10
If two process have the same length next CPU burst,FCFS scheduling is used to break the tie.
28
29
30
Memory management
y One of the most important tasks that an operating system does is manage the memory requirements of your computer.
31
Concept:
Main memory is usually too small to accommodate all the data and programs permanently, the computer system must provide secondary storage to back up main memory.
32
What is swapping?
y Swapping is just another word for trading (barter) or switching. y Replacing one segment of a program in memory with another and
33
Memory Allocation
y Multiple-partition allocation
Hole
process 2
34
35
36
Fragmentation
y Refers to the condition of a disk in which files are divided into pieces
scattered around the disk. Fragmentation occurs naturally when you use a disk frequently, creating, deleting, and modifying files. At some point, the operating system needs to store parts of a file in noncontiguous clusters. This is entirely invisible to users, but it can slow down the speed at which data is accessed because the disk drive must search through different parts of the disk to put together a single file
37
Fragmentation
y External Fragmentation
free memory space is broken non-contiguous pieces, none big enough to satisfy a request
y Internal Fragmentation
allocated memory may be slightly larger than requested memory; this size difference is memory internal to a partition, but not being used.
Paging
39
Paging example
y y
40
41
File System
Commonly, files represent programs (both source and object form) OR files are an abstraction mechanism. they provide a way to store information on the disk and read it back later. File mapped on physical device by the operating system, these storage devices are usually nonvolatile, so the contents are persistent through power failures and system reboots. Almost all information stored in a computer must be in a file.
42
File Structures
files can be structured in any of several ways.
1. 2. 3.
43
y Byte Sequence: is an unstructured sequence of bytes. File structure continue not know or care what is inIn effect, the operating system does the file.
All it sees are bytes, any meaning must be imposed by user-level programs. Both UNIX and MS-DOS use this approach.
record, each with some internal structure. Central to the idea of a file being a sequence of records is the idea that the read operation returns one record and the write operations overwrites or appends one record. necessarily all the same length, each containing a key filed in a fixed position in the record. The tree is sorted on the key field, to allow rapid searching for a particular key...
44
Sequential Access: In these systems a process could read all the bytes or records in a file in order Random Access: Files whose bytes or records can be read in any order are called random access file.
45
File Types
y
Regular files
are the once that contain user information.
46
File Attributes
y Every file has a name and its data. For example, the date and time the file was created or the file s size. We will call these extra items the file s attributes.
47
Name: only information kept in human-readable form. Type: needed for systems that support different types Location: pointer to file location on device Size: current file size Protection: controls who can do reading, writing, executing Time, Date, And User Identification: data for protection, security, and usage monitoring Information About Files Are Kept in the directory structure, which is maintained on the disk
48
File Operations
Files exist to store information and allow it to be retrieved later. Different systems provide different operations to allow storage and retrieval. Here is some common system operations relating to files these are...
49
Create: the file is created with no data. The purpose of the call is to announce that the file is coming and to set some of the attributes... Delete: when the file is no longer needed, it has to be deleted to free up disk space. Three is always a system cal for this purpose. Open: before using a file, a process must open it. The purpose of the OPEN call is to allow the system to fetch the attributes and list of disk address into main memory for rapid access on later calls. Close: the file closing mean to free up internal table space. Read: data are from file. Usually the bytes come form the current position. The caller must specify how much data are needed and must also provide a buffer to put them in.
y y
50
y Write: data continue usually current File operationsare written to the file, again,the fill s at theincreases.position. If the current position is the end of the file, size If the current
position is in the middle of the file. Existing data are overwritten and lost forever.
y Append: Mixing and merging the data of two or multi files and add them at the
y Seek: for random access files. Method is needed to specify from where to take
y Get Attributes: it s about the honor and modification times. Cause professes
often need to read file attributes to do their work. the file has been created.
y Set Attributes: Some of the attributes are user settable and can be changed after y Rename: if frequently happens that a user need to change the name of an
existing file.
51
File Sharing
y y y y
Sharing of files on multi-user systems is desirable Sharing may be done through a protection scheme On distributed systems, files may be shared across a network Network File System (NFS) is a common distributed file-sharing method
y User IDs
identify users, allowing permissions and protections to be per-user
y Group IDs
allow users to be in groups, permitting group access rights
52
53
server failure
y Recovery from failure can involve state information about status of each
remote request
y Stateless protocols such as NFS include all information in each request,
54
Protection
File owner/creator should be able to control
what can be done by whom ?
Types of access
1. 2. 3. 4. 5. 6.
55
Directories
To keep track of files, file system normally have directories, which , in many systems, are themselves files.
56
Name Type Address Current length Maximum length Date last accessed (for archival) Date last updated (for dump) Owner ID Protection information (discuss later)
57
58
Efficiency
locating a file quickly
Naming
convenient to users y Two users can have same name for different files y The same file can have several different names
Grouping
logical grouping of files by properties, (e.g., all Java programs, all games, )
59
Types of directories
1.
2.
3.
Here user can create their own directories and to organize their files accordingly.
4.
Acyclic-Graph Directories
1.
60
What is Linux?
Linux is a true 32-bit operating system that runs on a variety of different platforms, including Intel, Spark, Alpha, and Power-PC (on some of these platforms, such as Alpha, Linux is actually 64-bit).
61
Linux introduction
the same time)
y Command line/Gui y Open Office (By default office) y My Sql
y Open Source (code freely available, either from internet) y Administrator (root)
62
How Linux user accounts work Where Linux user accounts are stored Creating and managing user accounts from the command line
63
By default, all user home directories are created and maintained in the /home directory. However, the root user s home directory is /root
64
65
LINUX
y the first regular user account created on the system is always assigned a
UID of 1000. The next user account will be assigned a UID of 1001...
y The root user account is always assigned a UID of 0 on most Linux
distributions.
66
Where Linux User flexible operating system. One of its flexible features is Accounts Are Stored y Linux is a very
the location of user accounts on the system. When you originally installed the system, your distribution may have given you several options for where you wanted to store your user accounts.
y /etc/passwd file. This has been the default configuration used by Linux
management.this option will also show that how many user I have in a network.
y Windows domin: used for share purposes.
67
Local option
y /etc/passwd This file contains the user account information for your
system.
y /etc/shadow This file contains passwords for your user accounts. y /etc/group This file contains your system s groups.
68
Username:Password:UID:GID:Full_Name:Home_Directory:Default_Shel Username: The Username field simply identifies the username the user will supply when logging in to the system Password: This is a legacy field. At one time, the user s password was stored in encrypted form in this field in the passwd file. However, for security reasons, the password has been moved from /etc/passwd to /etc/shadow. UID This is the user ID for the user account GID This field references the group ID number of the user s default group Full_Name This field contains the user s full name Home_Directory This field contains the path to the user s home directory. Default_Shell This field specifies the shell that will be used by default
y y y y y
69
y Password This is the user s password in encrypted format y Last_Modified This field displays the number of days since January 1,
password must be changed. In this example, it is set to 99999 days. Effectively, this means a password isn t required.
expiration that the user will be warned of the pending expiration. In this case, it s set to 7 days.
70
Commands.
y Disabled_Days This field displays the number of days to wait after a password has
y Expire This field displays the number of days since January 1, 1970 after which the
account will be disabled. In this example, it is set to a null value, indicating the account never expires.
y To verify your /etc/passwd and /etc/shadow files, you can use the pwck command
at the shell prompt. This utility will verify each line in the two files and make sure they are valid. Any errors are reported on the screen.
71
72
Using usermod
y From time to time, you will need to modify an existing user account. The syntax
for usermod is very similar to that used by useradd. Syntax: usermod options username
Using userdel
Syntax: userdel username
73
y Using groupmod
y Syntax:
y Using groupdel
Syntax: groupdel group_name
74
75
FAQ Sy
y How do processes behave ? y What is a Real-Time Operating System? y How does system perform translation ? y What are the two main function of OS? y What advantage is there in having different time-quantum sizes
76