0% found this document useful (0 votes)
22 views

OS Notes Unit 1

Os unit 1 notes

Uploaded by

Jerry
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)
22 views

OS Notes Unit 1

Os unit 1 notes

Uploaded by

Jerry
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/ 25

OPERATING SYSTEMS

 An operating system acts as an intermediary between the user of a computer


and computer hardware. The purpose of an operating system is to provide an
environment in which a user can execute programs conveniently and
efficiently.
 It provides a set of services and functions that allow the efficient execution of
computer programs, manage hardware resources, and provide a user interface.
 The primary purpose of an operating system is to facilitate the interaction
between software and hardware components, ensuring that the computer
system operates smoothly and efficiently.

FUNCTIONS OF OPERATING SYSTEMS


1. Process Management:
 Supervising the execution of processes (programs in execution).
 Allocating CPU time, managing process scheduling, and handling process
synchronization.
2. Memory Management:
 Allocating and deallocating memory space for processes.
 Implementing virtual memory to allow efficient use of physical memory
and disk space.
3. File System Management:
 Organizing and managing files on storage devices.
 Providing a hierarchical structure of directories and files.
 Handling file creation, deletion, and manipulation.
4. Device Management:
 Controlling and communicating with hardware devices.
 Managing device drivers to enable interaction between the operating
system and peripherals.
5. Input/Output (I/O) Management:
 Handling communication between the central processing unit (CPU) and
external devices.
 Managing input and output operations to and from devices.
6. User Interface:
 Providing a means for users to interact with the computer system.
 Can include command-line interfaces (CLIs) or graphical user interfaces
(GUIs).
7. Security and Access Control:
 Enforcing user authentication and authorization.
 Controlling access to resources and protecting against unauthorized
access and data breaches.
8. Networking:
 Facilitating communication between devices on a network.
 Implementing network protocols and services for data transfer and
resource sharing.
9. Error Handling:
 Detecting and managing errors to ensure system stability.
 Attempting to recover the system to a stable state in case of errors.
10. System Calls and APIs:
 Providing a set of functions and procedures that applications can use to
request services from the operating system.
 Allowing applications to interact with the underlying hardware through
system calls.

ADVANTAGES OF OPERATING SYSTEMS


 It helps in managing the data present in the device i.e. Memory
Management.
 It helps in making the best use of computer hardware.
 It helps in maintaining the security of the device.
 It helps different applications in running them efficiently.

DISADVANTAGES OF OPERATING SYSTEMS


 Operating Systems can be difficult for someone to use.
 Some OS are expensive and they require heavy maintenance.
 Operating Systems can come under threat if used by hackers.

OS STRUCTURE
 Operating System structure is basically the model in which the system works.
The structure of the operating system should be user-friendly, such that if any
user having less knowledge about the system comes then he/she will not face
any difficulties while running the system.
COMPONENTS OF OPERATING SYSTEMS
1. Kernel:
 The core of the operating system.
 Manages essential system resources, such as CPU, memory, and I/O
devices.
 Provides a bridge between application software and hardware.
2. Device Drivers:
 Software modules that enable communication between the operating
system and hardware devices.
 Facilitate the control and management of peripherals such as printers,
disk drives, and graphics cards.
3. File System:
 Organizes and manages files on storage devices.
 Provides a hierarchical structure of directories and files.
 Manages file creation, deletion, and manipulation.
4. Process Management:
 Controls the execution of processes (programs in execution).
 Includes process creation, scheduling, and termination.
 Manages process synchronization and communication.
5. Memory Management:
 Allocates and deallocates memory space for processes.
 Implements virtual memory to optimize the use of physical memory and
disk space.
6. Input/Output (I/O) System:
 Manages communication between the CPU and external devices.
 Includes I/O drivers and provides an interface for applications to perform
I/O operations.
7. User Interface:
 Allows users to interact with the system.
 Can be a command-line interface (CLI) or a graphical user interface (GUI).
8. Security and Access Control:
 Enforces user authentication and authorization.
 Controls access to resources and protects against unauthorized access.
9. Networking:
 Manages communication between devices on a network.
 Implements network protocols and services for data transfer and
resource sharing.
10. System Libraries:
 Collections of pre-written code that provide common functionality to
applications.
 Allow developers to use standardized functions without implementing
them from scratch.
11. Shell:
 A command interpreter that allows users to interact with the operating
system using text commands.
 Executes commands and provides a way for users to control and
customize the system.
12. Utilities:
 System tools and programs that perform various tasks, such as disk
management, file compression, and system diagnostics.
 Enhance the functionality of the operating system and assist users in
managing their systems.

KERNEL
 The kernel is one of the components of the Operating System which works as a
core component. The rest of the components depends on Kernel for the supply
of the important services that are provided by the Operating System. The kernel
is the primary interface between the Operating system and Hardware.

Functions of Kernel

 It helps in controlling the System Calls.


 It helps in I/O Management.
 It helps in the management of applications, memory, etc.

Types of Kernel

 Monolithic Kernel
 Microkernel
 Hybrid Kernel
 Exokernel
SHELL
 Shell is the outermost layer of the Operating System and it handles the
interaction with the user.
 The main task of the Shell is the management of interaction between the User
and OS.
 Shell provides better communication with the user and the Operating System
Shell does it by giving proper input to the user it also interprets input for the
OS and handles the output from the OS.

Difference Between 32-Bit and 64-Bit Operating Systems

32-Bit Operating System 64-Bit Operating System

32-Bit OS is required for running of 32- 64-Bit Processors can run on any of the
Bit Processors, as they are not capable Operating Systems, like 32-Bit OS or 64-
of running on 64-bit processors. Bit OS.

32-Bit OS gives a low efficient 64-Bit Operating System provides


performance. highly efficient Performance.

Less amount of data is managed in 32-


A large amount of data can be stored in
Bit Operating System as compared to
64-Bit Operating System.
64-Bit Os.

32-Bit Operating System can address 64-Bit Operating System can address
2^32 bytes of RAM. 2^64 bytes of RAM.

SYSTEM CALLS
 System calls are interfaces or entry points through which applications or user-
level programs request services from the operating system's kernel.
 These services can include operations such as file manipulation, process control,
and communication.
 System calls allow applications to interact with the underlying hardware and
access various OS features in a controlled and secure manner.
TYPES OF SYSTEM CALLS
1. Process Control System Calls:
 fork(): Create a new process by duplicating the existing process.
 exec(): Replace the current process with a new one, loading a different
program into memory.
 exit(): Terminate the current process and return its resources to the
system.
2. File Management System Calls:
 open(): Open a file or create a new file if it does not exist.
 close(): Close an open file descriptor.
 read(): Read data from an open file.
 write(): Write data to an open file.
 seek(): Move the file pointer to a specific position in a file.
3. Device Management System Calls:
 ioctl(): Perform I/O control operations on devices.
 read(): Read data from a device.
 write(): Write data to a device.
4. Information Maintenance System Calls:
 getpid(): Get the process ID of the current process.
 getuid(): Get the user ID of the current user.
5. Communication System Calls:
 socket(): Create a communication endpoint for networking.
 send(): Send data over a network socket.
 recv(): Receive data over a network socket.
6. Memory Management System Calls:
 brk(): Set the end of the data segment of the calling process to the
specified value.
 sbrk(): Increment the program's data space (heap) by a specified number
of bytes.
 mmap(): Map files or devices into memory.
 munmap(): Unmap files or devices from memory.
7. Security System Calls:
 chmod(): Change the permissions of a file.
 chown(): Change the owner of a file.
8. Time System Calls:
 time(): Get the current time in seconds since the epoch.
9. Signal Handling System Calls:
 signal(): Set up signal handling for a process.

SYSTEM CALLS WORK
 User need special resources : Sometimes programs need to do some
special things which can’t be done without the permission of OS like
reading from a file, writing to a file , getting any information from the
hardware or requesting a space in memory.
 Program makes a system call request : There are special predefined
instruction to make a request to the operating system. These instruction
are nothing but just a “system call”. The program uses these system calls in
its code when needed.
 Operating system sees the system call : When the OS sees the system call
then it recongnises that the program need help at this time so it
temporarily stop the program execution and give all the control to special
part of itself called ‘Kernel’ . Now ‘Kernel’ solve the need of program.
 Operating system performs the operations :Now the operating system
perform the operation which is requested by program . Example : reading
content from a file etc.
 Operating system give control back to the program : After performing the
special operation, OS give control back to the program for further
execution of program .

NECESSARY OF SYSTEM CALLS


 Access to privileged operations: Many operations, such as managing hardware
devices or modifying system configurations, require higher privileges that are
only accessible through system calls.
 Resource management: System calls provide a standardized interface for
allocating and managing system resources like memory, files, and devices,
ensuring fair and controlled access by different processes.
 Abstraction: System calls abstract the underlying complexities of the operating
system, allowing application developers to interact with the system in a higher-
level, platform-independent manner.
 Security and protection: System calls enforce access control and security
policies, preventing unauthorized access to sensitive resources and protecting
the integrity of the system.
SYSTEM CALLS ADVANTAGES

 Access to hardware resources: System calls allow programs to access


hardware resources such as disk drives, printers, and network devices.
 Memory management: System calls provide a way for programs to allocate
and deallocate memory, as well as access memory-mapped hardware
devices.
 Process management: System calls allow programs to create and terminate
processes, as well as manage inter-process communication.
 Security: System calls provide a way for programs to access privileged
resources, such as the ability to modify system settings or perform
operations that require administrative permissions.

FEATURES OF SYSTEM CALLS


 Interface: System calls provide a well-defined interface between user
programs and the operating system. Programs make requests by calling
specific functions, and the operating system responds by executing the
requested service and returning a result.
 Protection: System calls are used to access privileged operations that are
not available to normal user programs. The operating system uses this
privilege to protect the system from malicious or unauthorized access.
 Kernel Mode: When a system call is made, the program is temporarily
switched from user mode to kernel mode. In kernel mode, the program has
access to all system resources, including hardware, memory, and other
processes.
 Context Switching: A system call requires a context switch, which involves
saving the state of the current process and switching to the kernel mode to
execute the requested service. This can introduce overhead, which can
impact system performance.
 Error Handling: System calls can return error codes to indicate problems
with the requested service. Programs must check for these errors and
handle them appropriately.
 Synchronization: System calls can be used to synchronize access to shared
resources, such as files or network connections. The operating system
provides synchronization mechanisms, such as locks or semaphores, to
ensure that multiple programs can access these resources safely.
TYPES OF OPERATING SYSTEMS
1) Batch Operating System

 This type of operating system does not interact with the computer directly.
There is an operator which takes similar jobs having the same requirement
and groups them into batches. It is the responsibility of the operator to sort
jobs with similar needs.

Advantages of Batch Operating System

 It is very difficult to guess or know the time required for any job to
complete. Processors of the batch systems know how long the job would be
when it is in the queue.
 Multiple users can share the batch systems.
 The idle time for the batch system is very less.
 It is easy to manage large work repeatedly in batch systems.

Disadvantages of Batch Operating System

 The computer operators should be well known with batch systems.


 Batch systems are hard to debug.
 It is sometimes costly.
 The other jobs will have to wait for an unknown time if any job fails.

Examples of Batch Operating Systems: Payroll Systems, Bank Statements, etc.

2. Multi-Programming Operating System

 Multiprogramming Operating Systems can be simply illustrated as more than


one program is present in the main memory and any one of them can be kept
in execution. This is basically used for better execution of resources.

Advantages of Multi-Programming Operating System

 Multi Programming increases the Throughput of the System.


 It helps in reducing the response time.
Disadvantages of Multi-Programming Operating System

 There is not any facility for user interaction of system resources with the
system.

3. Multi-Processing Operating System

 Multi-Processing Operating System is a type of Operating System in which


more than one CPU is used for the execution of resources. It betters the
throughput of the System.

Advantages of Multi-Processing Operating System

 It increases the throughput of the system.


 As it has several processors, so, if one processor fails, we can proceed with
another processor.

Disadvantages of Multi-Processing Operating System


 Due to the multiple CPU, it can be more complex and somehow difficult to
understand.

4. Multi-Tasking Operating System

 Multitasking Operating System is simply a multiprogramming Operating


System with having facility of a Round-Robin Scheduling Algorithm. It can run
multiple programs simultaneously.
There are two types of Multi-Tasking Systems which are listed below.
 Preemptive Multi-Tasking
 Cooperative Multi-Tasking

Advantages of Multi-Tasking Operating System

 Multiple Programs can be executed simultaneously in Multi-Tasking


Operating System.
 It comes with proper memory management.

Disadvantages of Multi-Tasking Operating System

 The system gets heated in case of heavy programs multiple times.


5. Time-Sharing Operating Systems

 Each task is given some time to execute so that all the tasks work smoothly.
Each user gets the time of the CPU as they use a single system. These systems
are also known as Multitasking Systems.
 The task can be from a single user or different users also. The time that each
task gets to execute is called quantum. After this time interval is over OS
switches over to the next task.

Advantages of Time-Sharing OS

 Each task gets an equal opportunity.


 Fewer chances of duplication of software.
 CPU idle time can be reduced.
 Resource Sharing: Time-sharing systems allow multiple users to share
hardware resources such as the CPU, memory, and peripherals, reducing
the cost of hardware and increasing efficiency.
 Improved Productivity: Time-sharing allows users to work concurrently,
thereby reducing the waiting time for their turn to use the computer. This
increased productivity translates to more work getting done in less time.
 Improved User Experience: Time-sharing provides an interactive
environment that allows users to communicate with the computer in real
time, providing a better user experience than batch processing.

Disadvantages of Time-Sharing OS

 Reliability problem.
 One must have to take care of the security and integrity of user programs
and data.
 Data communication problem.
 High Overhead: Time-sharing systems have a higher overhead than other
operating systems due to the need for scheduling, context switching, and
other overheads that come with supporting multiple users.
 Complexity: Time-sharing systems are complex and require advanced
software to manage multiple users simultaneously. This complexity
increases the chance of bugs and errors.
 Security Risks: With multiple users sharing resources, the risk of security
breaches increases. Time-sharing systems require careful management of
user access, authentication, and authorization to ensure the security of
data and software.

Examples of Time-Sharing OS with explanation

 IBM VM/CMS: IBM VM/CMS is a time-sharing operating system that was


first introduced in 1972. It is still in use today, providing a virtual machine
environment that allows multiple users to run their own instances of
operating systems and applications.
 TSO (Time Sharing Option): TSO is a time-sharing operating system that
was first introduced in the 1960s by IBM for the IBM System/360
mainframe computer. It allowed multiple users to access the same
computer simultaneously, running their own applications.
 Windows Terminal Services: Windows Terminal Services is a time-sharing
operating system that allows multiple users to access a Windows server
remotely. Users can run their own applications and access shared
resources, such as printers and network storage, in real-time.

6. Distributed Operating System

 These types of operating system is a recent advancement in the world of


computer technology and are being widely accepted all over the world and,
that too, at a great pace.
 Various autonomous interconnected computers communicate with each other
using a shared communication network.
 Independent systems possess their own memory unit and CPU. These are
referred to as loosely coupled systems or distributed systems. These systems’
processors differ in size and function.
 The major benefit of working with these types of the operating system is that
it is always possible that one user can access the files or software which are
not actually present on his system but some other system connected within
this network.

Advantages of Distributed Operating System

 Failure of one will not affect the other network communication, as all
systems are independent of each other.
 Electronic mail increases the data exchange speed.
 Since resources are being shared, computation is highly fast and durable.
 Load on host computer reduces.
 These systems are easily scalable as many systems can be easily added to
the network.
 Delay in data processing reduces.

Disadvantages of Distributed Operating System

 Failure of the main network will stop the entire communication.


 To establish distributed systems the language is used not well-defined yet.
 These types of systems are not readily available as they are very expensive.
Not only that the underlying software is highly complex and not understood
well yet.

Examples of Distributed Operating Systems : LOCUS, etc.

7. Network Operating System

 These systems run on a server and provide the capability to manage data,
users, groups, security, applications, and other networking functions. These
types of operating systems allow shared access to files, printers, security,
applications, and other networking functions over a small private network.
 One more important aspect of Network Operating Systems is that all the users
are well aware of the underlying configuration, of all other users within the
network, their individual connections, etc. and that’s why these computers
are popularly known as tightly coupled systems.

Advantages of Network Operating System

 Highly stable centralized servers.


 Security concerns are handled through servers.
 New technologies and hardware up-gradation are easily integrated into the
system.
 Server access is possible remotely from different locations and types of
systems.

Disadvantages of Network Operating System

 Servers are costly.


 User has to depend on a central location for most operations.
 Maintenance and updates are required regularly.
Examples of Network Operating Systems : Microsoft Windows Server 2003,
Microsoft Windows Server 2008, UNIX, Linux, Mac OS X, Novell NetWare, BSD, etc.

8. Real-Time Operating System

 These types of OSs serve real-time systems. The time interval required to
process and respond to inputs is very small. This time interval is
called response time.
 Real-time systems are used when there are time requirements that are very
strict like missile systems, air traffic control systems, robots, etc.

Types of Real-Time Operating Systems

 Hard Real-Time Systems:


Hard Real-Time OSs are meant for applications where time constraints are
very strict and even the shortest possible delay is not acceptable. These
systems are built for saving life like automatic parachutes or airbags which
are required to be readily available in case of an accident. Virtual memory is
rarely found in these systems.
 Soft Real-Time Systems:
These OSs are for applications where time-constraint is less strict.

Advantages of RTOS

 Maximum Consumption: Maximum utilization of devices and systems, thus


more output from all the resources.
 Task Shifting: The time assigned for shifting tasks in these systems is very
less. For example, in older systems, it takes about 10 microseconds in
shifting from one task to another, and in the latest systems, it takes 3
microseconds.
 Focus on Application: Focus on running applications and less importance
on applications that are in the queue.
 Real-time operating system in the embedded system: Since the size of
programs is small, RTOS can also be used in embedded systems like in
transport and others.
 Error Free: These types of systems are error-free.
 Memory Allocation: Memory allocation is best managed in these types of
systems.
Disadvantages of RTOS

 Limited Tasks: Very few tasks run at the same time and their concentration
is very less on a few applications to avoid errors.
 Use heavy system resources: Sometimes the system resources are not so
good and they are expensive as well.
 Complex Algorithms: The algorithms are very complex and difficult for the
designer to write on.
 Device driver and interrupt signals: It needs specific device drivers and
interrupts signal to respond earliest to interrupts.
 Thread Priority: It is not good to set thread priority as these systems are
very less prone to switching tasks.

Examples of Real-Time Operating Systems : Scientific experiments, medical imaging


systems, industrial control systems, weapon systems, robots, air traffic control
systems, etc.

SINGLE VS MULTI PROCESSOR SYSTEMS


Single-processor systems and multiprocessor systems differ in the number of central
processing units (CPUs) they contain and how they utilize these processors. Here are
some key points of comparison between single-processor systems and
multiprocessor systems:

1. Number of Processors:
 Single-Processor Systems:
 Contain only one central processing unit (CPU).
 Execute tasks sequentially, one at a time.
 Multiprocessor Systems:
 Have more than one CPU.
 Enable parallel processing, where multiple tasks can be executed
simultaneously.
2. Concurrency:
 Single-Processor Systems:
 Execute tasks sequentially, leading to a lack of true concurrency.
 Limited parallelism, as only one task is processed at a time.
 Multiprocessor Systems:
 Support true concurrency by allowing multiple tasks to be executed
in parallel.
 Improved throughput and performance for parallelizable
workloads.
3. Task Scheduling:
 Single-Processor Systems:
 Task scheduling involves deciding which task to execute next on the
single CPU.
 Limited to time-sharing or multitasking on a single processor.
 Multiprocessor Systems:
 More complex task scheduling to distribute tasks among multiple
processors.
 Load balancing algorithms aim to distribute tasks evenly for optimal
resource utilization.
4. Resource Utilization:
 Single-Processor Systems:
 Limited to the capabilities of a single CPU.
 Resource utilization may not be optimized for parallelizable
workloads.
 Multiprocessor Systems:
 Better resource utilization as tasks can be distributed among
multiple processors.
 Improved scalability for handling increased workloads.
5. Memory Access:
 Single-Processor Systems:
 Typically use a single memory space.
 Limited by the bandwidth of a single memory bus.
 Multiprocessor Systems:
 May have shared memory or distributed memory architectures.
 Coordination is required to manage access to shared resources.
6. Cost and Complexity:
 Single-Processor Systems:
 Generally less expensive and less complex.
 Simpler to design and manage.
 Multiprocessor Systems:
 Higher cost due to the additional hardware.
 Increased complexity in terms of hardware and software design.
7. Scalability:
 Single-Processor Systems:
 Limited scalability in handling increasing workloads.
 Performance improvement is constrained by the capabilities of a
single CPU.
 Multiprocessor Systems:
Can be scaled by adding more processors to handle larger
workloads.
 Potential for linear or near-linear performance improvement with
additional processors.
8. Fault Tolerance:
 Single-Processor Systems:
 Vulnerable to single points of failure.
 Multiprocessor Systems:
 Can be designed with redundancy for improved fault tolerance.
 Some level of fault tolerance can be achieved through redundancy
and load balancing.

MULTIPROGRAMMING, MULTITASKING, MULTIPROCESSING


& MULTITHREADING
1. Multiprogramming – Multiprogramming is known as keeping multiple programs in
the main memory at the same time ready for execution.
2. Multiprocessing – A computer using more than one CPU at a time.
3. Multitasking – Multitasking is nothing but multiprogramming with a Round-robin
scheduling algorithm.
4. Multithreading is an extension of multitasking.

Feature Multiprogramming Multitasking Multithreading Multiprocessing

Running
Running Running multiple
Running multiple multiple tasks
multiple threads processes on
Definition programs on a (applications)
within a single multiple CPUs
single CPU on a single
task (application) (or cores)
CPU

Resources
Resources (CPU, Each process has
Resources (CPU, (CPU,
Resource memory) are its own set of
memory) are shared memory) are
Sharing shared among resources (CPU,
among programs shared among
threads memory)
tasks

Uses priority- Uses priority-


Uses round-robin or
based or time- based or time- Each process can
priority-based
slicing slicing have its own
Scheduling scheduling to
scheduling to scheduling to scheduling
allocate CPU time
allocate CPU allocate CPU algorithm
to programs
time to tasks time to threads
Each program has Each task has Threads share Each process has
Memory
its own memory its own memory space its own memory
Management
space memory space within a task space

Requires a Requires a Requires a


Requires a context
Context context switch context switch to context switch to
switch to switch
Switching to switch switch between switch between
between programs
between tasks threads processes

Uses thread Uses inter-


Uses message
synchronization process
Inter-Process Uses message passing or
mechanisms communication
Communication passing or shared shared
(e.g., locks, mechanisms
(IPC) memory for IPC memory for
semaphores) for (e.g., pipes,
IPC
IPC sockets) for IPC

PROCESS STATE
In an operating system, a process can exist in several states as it goes through its
lifecycle. The process state represents the current condition or stage of a process in
its execution. The different process states help the operating system manage and
control the execution of processes efficiently. Common process states include:

1. New:
 The process is being created.
 The operating system is initializing the necessary data structures for the
process.
2. Ready:
 The process is prepared to execute but is waiting for the CPU to be
assigned to it.
 Processes in the ready state are typically part of a pool of tasks awaiting
execution.
3. Running:
 The process is actively being executed by the CPU.
 In a multiprogramming system, multiple processes may be in the running
state simultaneously if there are multiple CPUs or if time-sharing is used.
4. Blocked (Waiting):
 The process is not able to execute because it is waiting for some event to
occur.
 Common scenarios leading to the blocked state include waiting for user
input, I/O operations, or completion of another process.
5. Terminated:
 The process has finished its execution.
 Resources allocated to the process, such as memory and system handles,
are released.
 The process may communicate its exit status to the parent process or the
operating system.

COOPERATING PROCESS
Cooperating processes, also known as concurrent processes or concurrent threads,
are processes that can communicate and synchronize with each other to achieve a
common goal or to solve a particular problem. Cooperation between processes is
essential in scenarios where tasks need to be performed concurrently or where
collaboration is required. Here are some details about cooperating processes:

1. Shared Data:
 Cooperating processes often share data or resources.
 Shared data allows processes to exchange information and coordinate
their activities.
2. Inter-Process Communication (IPC):
 IPC mechanisms enable communication between cooperating processes.
 Common IPC mechanisms include shared memory, message passing,
semaphores, and pipes.
3. Reasons for Cooperation:
 Speedup: Tasks can be performed concurrently, leading to faster overall
execution.
 Modularity: Large problems can be divided into smaller, manageable
tasks that can be solved independently by cooperating processes.
 Resource Sharing: Processes can share resources, such as files,
databases, or hardware devices.
4. Concurrency:
 Cooperating processes execute concurrently, meaning they may overlap
in time.
 Concurrent execution can lead to improved system responsiveness and
resource utilization.
5. Independent Execution:
 Each cooperating process is typically an independent entity with its own
program counter, registers, and stack.
 Processes may run independently, but they need to coordinate their
activities when interacting with shared data.
6. Synchronization:
 Processes need synchronization mechanisms to avoid conflicts and
ensure the orderly execution of shared tasks.
 Synchronization primitives like semaphores or mutexes help control
access to shared resources.
7. Communication Models:
 Message Passing: Processes communicate by sending and receiving
messages. This can be either direct or through message-passing channels.
 Shared Memory: Processes share a common, addressable memory space,
allowing them to read and write to shared variables.
8. Parallelism:
 Cooperating processes can exploit parallelism to enhance system
performance.
 Parallel execution of tasks can lead to improved throughput and reduced
execution time.
9. Examples:
 Web servers: Multiple processes handling requests concurrently.
 Database systems: Concurrent transactions accessing shared data.
 Parallel computing: Splitting a computational task into multiple processes
for parallel execution.
10. Challenges:
 Race Conditions: Conflicts that arise when multiple processes access
shared data concurrently.
 Deadlocks: Situations where processes are unable to proceed because
they are waiting for each other to release resources.
 Starvation: A process may be denied resources indefinitely, leading to its
inability to make progress.

THREADS
 Thread refers to the smallest unit of execution within a process. Threads share
the same resources, such as memory space and file descriptors, while each
thread has its own program counter, register set, and stack.
 Threads within the same process can communicate and share data more easily
than processes, which have more isolated memory spaces. Here are key details
about threads in operating systems:

1. Thread Characteristics:
 Lightweight: Threads are generally lighter weight than processes,
requiring less overhead to create and switch between.
 Independence: Threads within the same process operate independently
but share resources.
2. Types of Threads:
 User-Level Threads (ULTs): Managed entirely by user-level libraries or
applications. The operating system is unaware of these threads.
 Kernel-Level Threads (KLTs): Managed by the operating system kernel.
The kernel is aware of and manages these threads.
3. Multithreading Models:
 Many-to-One Model (User-Level Threads): Many user-level threads map
to a single kernel-level thread. Thread management is handled entirely by
the user-level thread library.
 One-to-One Model (Kernel-Level Threads): Each user-level thread
corresponds to one kernel-level thread. Thread management is handled
by the operating system.
4. Benefits of Multithreading:
 Concurrency: Threads allow for concurrent execution of tasks within a
process.
 Responsiveness: Multithreading can improve the responsiveness of
applications by allowing certain tasks to continue while others are waiting
for resources.
 Parallelism: Threads enable parallelism, where multiple threads can
execute simultaneously on multi-core processors.
5. Thread States:
 Running: The thread is actively executing on the CPU.
 Ready: The thread is ready to execute but waiting for the CPU.
 Blocked: The thread is waiting for an event, such as I/O completion.
 Terminated: The thread has completed its execution.

6. Thread Creation and Termination:


 Threads are created using system calls or thread libraries.
 Termination can be voluntary (e.g., thread exit) or involuntary (e.g.,
program termination).
7. Thread Synchronization:
 Threads may need synchronization mechanisms to coordinate access to
shared resources.
 Synchronization primitives include mutexes, semaphores, and condition
variables.
8. Thread Safety:
 Thread safety refers to the ability of a program or system to function
correctly when multiple threads are executing concurrently.
 Code or data structures are considered thread-safe if they can be safely
used by multiple threads without causing data corruption or program
failures.
9. Thread Local Storage (TLS):
 Threads can have their own private data that is not shared with other
threads.
 TLS is used to allocate and manage data that is specific to each thread.
10. Challenges:
 Race Conditions: Conflicts that arise when multiple threads access shared
data concurrently.
 Deadlocks: Situations where threads are unable to proceed because they
are waiting for each other to release resources.
 Starvation: A thread may be denied resources indefinitely, leading to its
inability to make progress.
11. Examples of Thread Usage:
 Web servers: Handling multiple client requests concurrently using
threads.
 GUI applications: Using threads to keep the user interface responsive
while performing background tasks.

LINUX OPERATING SYSTEM


 Linux is a popular open-source, Unix-like operating system kernel that serves as
the foundation for various operating systems, commonly referred to as Linux
distributions or "distros."
 The Linux kernel was created by Linus Torvalds in 1991 and has since been
developed collaboratively by a large community of developers worldwide.

1. Linux Kernel:
 The core of the Linux operating system is the Linux kernel. It is
responsible for managing system resources, hardware interactions, and
providing essential services.
2. Open Source and Free Software:
 Linux is distributed under the terms of the GNU General Public License
(GPL), making it open source and freely available for anyone to use,
modify, and distribute.
3. Distributions (Distros):
 Linux is often distributed in the form of complete operating system
distributions, commonly known as distros.
 Popular Linux distributions include Ubuntu, Debian, Fedora, CentOS, Arch
Linux, and many more.
 Each distribution may have its own package management system, default
desktop environment, and configuration tools.
4. Package Management:
 Most Linux distributions use a package management system to simplify
software installation, removal, and updates.
 Common package managers include APT (Advanced Package Tool), YUM
(Yellowdog Updater, Modified), and Pacman.
5. Terminal and Command Line:
 Linux is known for its powerful command-line interface (CLI), and users
can perform a wide range of tasks using the terminal.
 The Bash shell is a common default shell in many Linux distributions.
6. User and Group Management:
 Linux supports multi-user environments with user accounts and group
management.
 Permissions and ownership of files and directories are crucial for security
and access control.
7. File System:
 Linux uses various file systems, with ext4 being a common choice for
many distributions.
 The file system hierarchy adheres to the Filesystem Hierarchy Standard
(FHS), which defines the directory structure and organization.
8. Networking:
 Linux supports a wide range of networking protocols and services.
 It is commonly used as a server operating system for web servers, file
servers, and networking infrastructure.
9. Security:
 Linux has a strong security model with features such as user privileges,
file permissions, and security-enhanced Linux (SELinux).
 Regular security updates are released by the Linux community to address
vulnerabilities.

COMMANDS OF LINUX OPERATING SYSTEMS


Linux provides a command-line interface (CLI) for interacting with the operating
system. Here are some basic Linux commands:

1. Navigation:
 ls: List files and directories.
 cd: Change directory.
 pwd: Print working directory.
2. File Management:
 cp: Copy files or directories.
 mv: Move or rename files or directories.
 rm: Remove files or directories.
 touch: Create an empty file.
3. Directory Operations:
 mkdir: Create a new directory.
 rmdir: Remove an empty directory.
 rm -r: Remove a directory and its contents recursively.
4. Viewing Content:
 cat: Display the content of a file.
 more or less: Display content page by page.
 head and tail: Display the beginning or end of a file.
5. File Editing:
 nano or vim: Text editors for creating or editing files.
 gedit: Graphical text editor.
6. File Permissions:
 chmod: Change file permissions.
 chown: Change file owner.
 chgrp: Change file group.
7. User Management:
 whoami: Display the current username.
 passwd: Change user password.
 useradd: Add a new user.
 userdel: Delete a user.
 su: Switch user.
8. Process Management:
 ps: Display information about processes.
 kill: Terminate a process.
 top: Display dynamic, real-time system statistics.
9. System Information:
 uname: Display system information.
 hostname: Display or set the system hostname.
 df: Display disk space usage.
 du: Display file and directory space usage.
10. Networking:
 ifconfig or ip: Display network interface information.
 ping: Test network connectivity.
 netstat: Display network statistics.
 traceroute: Display the route packets take to reach a destination.
11. Package Management (package-based distributions):
 apt (Debian/Ubuntu): Advanced Package Tool for package management.
 yum (Red Hat/CentOS): Yellowdog Updater Modified for package
management.
12. Compression and Archiving:
 tar: Create, extract, or view compressed or archived files.
 gzip, bzip2, xz: Compress or decompress files.
13. Searching and Finding:
 grep: Search for patterns in files.
 find: Search for files and directories.
 locate: Quickly find the location of files.
14. File System Operations:
 mount: Mount a file system.
 umount: Unmount a file system.
 fdisk: Partition table manipulator.
15. System Shutdown/Reboot:
 shutdown: Shutdown or restart the system.
 reboot: Reboot the system.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy