0% found this document useful (0 votes)
25 views9 pages

ملخص نظم التشغيل

Uploaded by

Lou Sam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views9 pages

ملخص نظم التشغيل

Uploaded by

Lou Sam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Ch1

An OS is a program that controls the execution of application programs and acts as an interface
between applications and the computer hardware.
It can be thought of as having three objectives:
• Convenience: An OS makes a computer more convenient to use.
• Efficiency: An OS allows the computer system resources to be used in an efficient manner .
• Ability to evolve: An OS should be constructed in such a way as to permit the effective
development, testing, and introduction of new system functions without interfering with service.
Functions of OS:
Security. Device Management. Processor Management.
Job accounting. File Management. Control over system performance.
Memory Management. Error detecting aids. Coordination between other software and users.
The OS typically provides services in the following areas :
• Program development. • Program execution.
• Access to I/O devices. • Controlled access to files.
• System access. • Error detection and response.
• Accounting.
The central idea behind the simple batch-processing scheme is the use of a piece of software known
as the monitor.
job control language (JCL): This is a special type of programming language used to provide
instructions to the monitor. Example is programming language FORTRAN
Interrupts: This feature gives the OS more flexibility in relinquishing control to and regaining
control from user programs.
In a time-sharing system, multiple users simultaneously access the system through terminals, with
the OS interleaving the execution of each user program in a short burst or quantum of computation .
A system clock generated interrupts at a rate of approximately one every 0.2 seconds. At each clock
interrupt, the OS regained control and could assign the processor to another user. This technique is
known as time slicing.
Four major theoretical advances in the development of operating systems :
• Processes. • Memory management.
• Information protection and security. • Scheduling and resource management.
The OS, has five principal storage management responsibilities:
• Process isolation. • Automatic allocation and management.
• Support of modular programming. • Protection and access control.
• Long-term storage.
Much of the work in security and protection as it relates to operating systems can be roughly
grouped into four categories :
• Availability. • Confidentiality. • Data integrity. • Authenticity.
Symmetric multiprocessing (SMP) is a term that refers to a computer hardware architecture, The OS
of an SMP schedules processes or threads across all of the processors.
SMP has a number of potential advantages over uniprocessor architecture :
• Performance. • Availability. • Incremental growth. • Scaling.

Mahmoud Jamil
https://t.me/Mahmoud_1420h ‫ أو عن طريق التليجرام‬[email protected] :‫في حال وجود تعديل يرجى التواصل على اإليميل اآلتي‬
A distributed operating system provides the illusion of a single main memory space and a single
secondary memory space, plus other unified access facilities, such as a distributed file system .
Another innovation in OS design is the use of object-oriented technologies .
To protect a system, we must take security measures at four levels :
• Physical. • Human. • Operating system. • Network.
A virtual machine is a computer file, typically called an image, that behaves like an actual computer.
In other words, creating a computer within a computer. It runs in a window, much like any other
program, giving the end user the same experience on a virtual machine as they would have on the
host operating system itself.
The following list includes several forms of accidental and malicious security violations:
• Breach of confidentiality: This type of violation involves unauthorized reading of data.
• Breach of integrity: This violation involves unauthorized modification of data.
• Breach of availability: This violation involves unauthorized destruction of data.
• Theft of service: This violation involves unauthorized use of resources .
• Denial of service: This violation involves preventing legitimate use of the system. Denial-of-
service (DOS) attacks are sometimes accidental.
The difference between Batch Multiprogramming and Time Sharing:
Batch Multiprogramming Time Sharing
Principal objective Maximize processor use Minimize response time
Source of directives to OS Job control language commands Commands entered at the terminal
provided with the job
Ch2
The file system permits users to create data collections, called files, with desirable properties, such as:
• Long-term existence. • Sharable between processes. • Structure.
Typical operations include the following on the file:
• Create: A new file is defined and positioned within the structure of files,
• Delete: A file is removed from the file structure and destroyed.
• Open: An existing file is declared to be “opened” by a process, allowing the process to perform
functions on the file.
• Close: The file is closed with respect to a process, so that the process no longer may perform
functions on the file, until the process opens the file again.
• Read: A process reads all or a portion of the data in a file.
• Write: A process updates a file, either by adding new data that expands the size of the file or by
changing the values of existing data items in the file.
File Structure Four terms are in common use when discussing files:
• A field is the basic element of data. An individual field contains a single value.
• A record is a collection of related fields that can be treated as a unit by some application program.
• A file is a collection of similar records. The file is treated as a single entity by users and
applications and may be referenced by name. Files have file names and may be created and deleted.
• A database is a collection of related data. The essential aspects of a database are that the
relationships that exist among elements of data are explicit and that the database is designed for use
by a number of different applications.

Mahmoud Jamil
https://t.me/Mahmoud_1420h ‫ أو عن طريق التليجرام‬[email protected] :‫في حال وجود تعديل يرجى التواصل على اإليميل اآلتي‬
A file management system is that set of system software that provides services to users and
applications in the use of files. the following objectives for a file management system:
• To meet the data management needs and requirements of the user.
• To guarantee, to the extent possible, that the data in the file are valid.
• To optimize performance, both from the system point of view in terms of overall throughput and
from the user’s point of view in terms of response time.
• To provide I/O support for a variety of storage device types.
• To minimize or eliminate the potential for lost or destroyed data.
• To provide a standardized set of I/O interface routines to user processes.
• To provide I/O support for multiple users, in the case of multiple-user systems.
In choosing a file organization, several criteria are important:
• Short access time.
• Ease of update.
• Economy of storage.
• Simple maintenance.
• Reliability.

The types of operations that may be performed on the directory:


• Search: When a user or application references a file, the directory must be searched to find the
entry corresponding to that file.
• Create file: When a new file is created, an entry must be added to the directory.
• Delete file: When a file is deleted, an entry must be removed from the directory.
• List directory: All or a portion of the directory may be requested. Generally, this request is made by
a user and results in a listing of all files owned by that user, plus some of the attributes of each file.
• Update directory: Because some file attributes are stored in the directory, a change in one of these
attributes requires a change in the corresponding directory entry.
The following list is representative of access rights that can be assigned to a particular user for a
particular file:
• None: The user may not even learn of the existence of the file, much less access it.
• Knowledge: The user can determine that the file exists and who its owner is.
• Execution: The user can load and execute a program but cannot copy it.
• Reading: The user can read the file for any purpose, including copying and execution.
• Appending: The user can add data to the file, often only at the end, but cannot modify or delete any
of the file's contents.
• Updating: The user can modify, delete, and add to the file's data.
• Changing protection: The user can change the access rights granted to other users.
• Deletion: The user can delete the file from the file system.
On secondary storage, a file consists of a collection of blocks. The operating system or file
management system is responsible for allocating blocks to files.

Mahmoud Jamil
https://t.me/Mahmoud_1420h ‫ أو عن طريق التليجرام‬[email protected] :‫في حال وجود تعديل يرجى التواصل على اإليميل اآلتي‬
Ch3
while the program is executing, this process can be uniquely characterized by a number of elements,
including the following:
• Identifier: A unique identifier associated with this process, to distinguish it from all other processes.
• State: If the process is currently executing, it is in the running state.
• Priority: Priority level relative to other processes.
• Program counter: The address of the next instruction in the program to be executed.
• Memory pointers: Includes pointers to the program code and data associated with this process, plus
any memory blocks shared with other processes.
• Context data: These are data that are present in registers in the processor while the process is
executing.
• I/O status information: Includes outstanding I/O requests, I/O devices (e.g., tape drives) assigned to
this process, a list of files in use by the process, and so on.
• Accounting information: May include the amount of processor time and clock time used, time limits,
account numbers, and so on.
The information in the preceding list is stored in a data structure, typically called a process control
block.
Reasons for Process Creation:
New batch job The OS is provided with a batch job control stream, usually on tape
or disk. When the OS is prepared to take on new work, it will read the
next sequence of job control commands.
Interactive log-on A user at a terminal logs on to the system.
Created by OS to provide a The OS can create a process to perform a function on behalf of a user
service program, without the user having to wait (e.g., a process to control
printing).
Spawned by existing process For purposes of modularity or to exploit parallelism, a user program
can dictate the creation of a number of processes.
When the OS creates a process at the explicit request of another process, the action is referred to as
process spawning.
When one process spawns another, the former is referred to as the parent process.
the spawned process is referred to as the child process.
Reasons for Process Termination:
Normal completion The process executes an OS service call to indicate that it has completed
running.
Time limit exceeded The process has run longer than the specified total time limit.There are a
number of possibilities for the type of time that is measured.These include
total elapsed time (“wall clock time”), amount of time spent executing, and,
in the case of an interactive process, the amount of time since the user last
provided any input.
Memory unavailable The process requires more memory than the system can provide.
Bounds violation The process tries to access a memory location that it is not allowed to access.
Protection error The process attempts to use a resource such as a file that it is not allowed to
use, or it.

Mahmoud Jamil
https://t.me/Mahmoud_1420h ‫ أو عن طريق التليجرام‬[email protected] :‫في حال وجود تعديل يرجى التواصل على اإليميل اآلتي‬
Arithmetic error The process tries a prohibited computation, such as division by zero, or tries
to store numbers larger than the hardware can accommodate.
Time overrun The process has waited longer than a specified maximum for a certain event
to occur.
I/O failure An error occurs during input or output, such as inability to find a file, failure
to read or write after a specified maximum number of tries (when, for
example, a defective area is encountered on a tape), or invalid operation
(such as reading from the line printer).
Invalid instruction The process attempts to execute a nonexistent instruction (often a result of
branching into a data area and attempting to execute the data).
Privileged instruction The process attempts to use an instruction reserved for the operating system.

Data misuse A piece of data is of the wrong type or is not initialized.


Operator or OS For some reason, the operator or the operating system has terminated the
intervention process (for example, if a deadlock exists).
Parent termination When a parent terminates, the operating system may automatically
terminate all of the offspring of that parent.
Parent request A parent process typically has the authority to terminate any of its offspring.
The five states in this new diagram are as follows:
• Running: The process that is currently being executed.
• Ready: A process that is prepared to execute when given the opportunity.
• Blocked/Waiting:4 A process that cannot execute until some event occurs, such as the completion of
an I/O operation.
• New: A process that has just been created but has not yet been admitted to the pool of executable
processes by the OS.
• Exit: A process that has been released from the pool of executable processes by the OS, either because
it halted or because it aborted for some reason.
Memory tables are used to keep track of both main (real) and secondary (virtual) memory.
The less-privileged mode is often referred to as the user mode, because user programs typically would
execute in this mode. The more-privileged mode is referred to as the system mode, control mode, or
kernel mode.
four basic thread operations:
• Spawn: Typically, when a new process is spawned, a thread for that process is also spawned.
• Block: When a thread needs to wait for an event, it will block (saving its user registers, program
counter, and stack pointers).
• Unblock: When the event for which a thread is blocked occurs, the thread is moved to the Ready
queue.
• Finish: When a thread completes, its register context and stacks are deallocated.
relationship between threads and processes:
Threads :
Description Example Systems
Processes
1:1 Each thread of execution is a unique process with its own Traditional UNIX
address space and resources. implementations.
M:1 A process defines an address space and dynamic resource Windows NT, Solaris,
ownership. Multiple threads may be created and executed Linux, OS/2, OS/390,
within that process. MACH.
Mahmoud Jamil
https://t.me/Mahmoud_1420h ‫ أو عن طريق التليجرام‬[email protected] :‫في حال وجود تعديل يرجى التواصل على اإليميل اآلتي‬
1:M A thread may migrate from one process environment to Ra (Clouds), Emerald.
another. This allows a thread to be easily moved among
distinct systems.
M:N Combines attributes of M:1 and 1:M cases. TRIX.
Benefits of a Microkernel Organization:
• Uniform interfaces.
• Extensibility.
• Flexibility.
• Portability.
• Reliability.
• Distributed system support.
• Support for object-oriented operating systems (OOOSS).
Thread States, An existing Windows thread is in one of six states:
• Ready: May be scheduled for execution.
• Standby: A standby thread has been selected to run next on a particular processor.
• Running: Once the Kernel dispatcher performs a thread switch, the standby thread enters the Running
state and begins execution and continues execution.
• Waiting: A thread enters the Waiting state when (1) it is blocked on an event (e.g., I/O), (2) it
voluntarily waits for synchronization purposes, or (3) an environment subsystem directs the thread
to suspend itself.
• ansition: A thread enters this state after waiting if it is ready to run but the resources are not available.
• Terminated: A thread can be terminated by itself, by another thread, or when its parent process
terminates.
Ch4
Types of Scheduling:
Long-term scheduling The decision to add to the pool of processes to be executed.
Medium-term scheduling. The decision to add to the number of processes that are partially or
fully in main memory.
Short-term scheduling The decision as to which available process will be executed by the
processor.
I/O scheduling The decision as to which process’s pending I/O request shall be
handled by an available I/O device.
Long-Term Scheduling:
The long-term scheduler determines which programs are admitted to the system for processing.
Thus, it controls the degree of multiprogramming. Once admitted, a job or user program becomes a
process and is added to the queue for the short-term scheduler. In some systems, a newly created
process begins in a swapped-out condition, in which case it is added to a queue for the medium-term
scheduler.
Medium-Term Scheduling:
Medium-term scheduling is part of the swapping function. Typically, the swapping-in decision is
based on the need to manage the degree of multiprogramming. On a system that does not use virtual
memory, memory management is also an issue. Thus, the swapping-in decision will consider the
memory requirements of the swapped-out processes.

Mahmoud Jamil
https://t.me/Mahmoud_1420h ‫ أو عن طريق التليجرام‬[email protected] :‫في حال وجود تعديل يرجى التواصل على اإليميل اآلتي‬
Short-Term Scheduling:
The short-term scheduler is invoked whenever an event occurs that may lead to the blocking of the
current process or that may provide an opportunity to preempt a currently running process in favor of
another. Examples of such events include:
• Clock interrupts.
• I/O interrupts.
• Operating system calls.
• Signals (e.g., semaphores).
Ch5
A race condition occurs when multiple processes or threads read and write data items so that the final
result depends on the order of execution of instructions in the multiple processes.
Common Concurrency Mechanisms:
• Semaphore.
we can view the semaphore as a variable that has an integer value upon which only three
operations are defined:
1. A semaphore may be initialized to a nonnegative integer value.
2. The semWait operation decrements the semaphore value. If the value becomes negative, then
the process executing the semWait is blocked. Otherwise, the process continues execution.
3. The semSignal operation increments the semaphore value. If the resulting value is less than
or equal to zero, then a process blocked by a semWait operation, if any, is unblocked.
• Binary Semaphore.
A binary semaphore may only take on the values 0 and 1 and can be defined by the following
three operations:
1. A binary semaphore may be initialized to 0 or 1.
2. The semWaitB operation checks the semaphore value. If the value is zero, then the process
executing the semWaitB is blocked. If the value is one, then the value is changed to zero and
the process continues execution.
3. The semSignalB operation checks to see if any processes are blocked on this semaphore
(semaphore value equals 0). If so, then a process blocked by a semWaitB operation is
unblocked. If no processes are blocked, then the value of the semaphore is set to one.
• Mutex.
• Condition Variable.
• Monitor.
• Event Flags.
• Mailboxes/Messages.
• Spinlocks.
Reader Writer problem in concurrency:
The readers/writers problem is defined as follows: There is a data area shared among a number of
processes. The data area could be a file, a block of main memory, or even a bank of processor registers.
There are a number of processes that only read the data area (readers) and a number that only write to
the data area (writers). The conditions that must be satisfied are as follows:
• Any number of readers may simultaneously read the file.
• Only one writer at a time may write to the file.
• If a writer is writing to the file, no reader may read it.
Mahmoud Jamil
https://t.me/Mahmoud_1420h ‫ أو عن طريق التليجرام‬[email protected] :‫في حال وجود تعديل يرجى التواصل على اإليميل اآلتي‬
A process requests resources; if the resources are not available at that time, the process enters a waiting
state. Sometimes, a waiting process is never again able to change state, because the resources it has
requested are held by other waiting processes. This situation is called a deadlock.
A deadlock situation can arise if the following four conditions hold simultaneously in a system:
• Mutual exclusion. At least one resource must be held in a nonsharable mode; that is, only one process
at a time can use the resource. If another process requests that resource, the requesting process must
be delayed until the resource has been released.
• Hold and wait. A process must be holding at least one resource and waiting to acquire additional
resources that are cmrently being held by other processes.
• No preemption. Resources cannot be preempted; that is, a resource can be released only voluntarily
by the process holding it, after that process has completed its task.
• Circular wait. A set { P0 , Pl, ... , P11 } of waiting processes must exist such that Po is waiting for a
resource held by P1, P1 is waiting for a resource held by P2, ... , Pn-1 is waiting for a resource held
by P,v and P11 is waiting for a resource held by P0.
Deadlocks can be described more precisely in terms of a directed graph called a System resource-
allocation graph.
we can deal with the deadlock problem in one of three ways:
• We can use a protocol to prevent or avoid deadlocks, ensuring that the system will never enter
a deadlocked state.
• We can allow the system to enter a deadlocked state, detect it, and recover.
• We can ignore the problem altogether and pretend that deadlocks never occur in the system.
Mutual Exclusion:
The mutual-exclusion condition must hold for nonsharable resources. For example, a printer cannot
be simultaneously shared by several processes. Sharable resources, in contrast, do not require mutually
exclusive access and thus cannot be involved in a deadlock.
A state is safe if the system can allocate resources to each process (up to its maximum) in some order
and still avoid a deadlock. More formally, a system is in a safe state only if there exists a safe sequence.
How we can recover from deadlock? Elaborate it.
1. Process Termination: To eliminate the deadlock, we can simply kill one or more processes. For this,
we use two methods:
• Abort all the Deadlocked Processes: Aborting all the processes will certainly break the deadlock, but
with a great expenses. The deadlocked processes may have computed for a long time and the result
of those partial computations must be discarded and there is a probability to recalculate them later.
• Abort one process at a time untill deadlock is eliminated: Abort one deadlocked process at a time,
untill deadlock cycle is eliminated from the system. Due to this method, there may be considerable
overhead, because after aborting each process, we have to run deadlock detection algorithm to check
whether any processes are still deadlocked.
2. Resource Preemption: To eliminate deadlocks using resource preemption, we preepmt some
resources from processes and give those resources to other processes. This method will raise three
issues –
• Selecting a victim: We must determine which resources and which processes are to be preempted
and also the order to minimize the cost.
• Rollback: We must determine what should be done with the process from which resources are
preempted. One simple idea is total rollback. That means abort the process and restart it.

Mahmoud Jamil
https://t.me/Mahmoud_1420h ‫ أو عن طريق التليجرام‬[email protected] :‫في حال وجود تعديل يرجى التواصل على اإليميل اآلتي‬
• Starvation: In a system, it may happen that same process is always picked as a victim. As a result,
that process will never complete its designated task. This situation is called Starvation and must be
avoided. One solution is that a process must be picked as a victim only a finite number of times.
Ch6
Compile time. If you know at compile time where the process will reside in memory, then absolute
code can be generated.
Load time. If it is not known at compile time where the process will reside in memory, then the
compiler must generate relocatable code. In this case, final binding is delayed until load time.
Execution time. If the process can be moved during its execution from one memory segment to
another, then binding must be delayed until run time.
programs that are compiled with the new library version are affected by any incompatible changes
incorporated in it. Other programs linked before the new library was installed will continue using the
older library. This system is also known as shared libraries.
A C compiler might create separate segments for the following:
• The code.
• Global variables.
• The heap, from which memory is allocated.
• The stacks used by each thread.
• The standard C library.
Thrashing:
If the number of frames allocated to a low-priority process falls below the minimum number required
by the computer architecture, we must suspend that process's execution. We should then page out its
remaining pages, freeing all its allocated frames. This provision introduces a swap-in, swap-out level
of intermediate CPU scheduling.

Mahmoud Jamil
https://t.me/Mahmoud_1420h ‫ أو عن طريق التليجرام‬[email protected] :‫في حال وجود تعديل يرجى التواصل على اإليميل اآلتي‬

You might also like