SlideShare uma empresa Scribd logo
1 de 15
Process Concept 1
 A process can be thought of as a program in execution.
 A process will need certain resources-such as CPU time, memory, files, and I/O devices-to accomplish
its task.
 These resources are allocated to the process either when it is created or while it is executing.
 A process is the unit of work in most systems.
 Systems consist of a collection of processes: Operating-system processes execute system code, and
user processes execute user code. All these processes may execute concurrently.
 Although traditionally a process contained only a single thread of control as it ran, most modem
operating systems now support processes that have multiple threads.
 The operating system is responsible for the following activities in connection with process and thread
management: the creation and deletion of both user and system processes; the scheduling of
processes; and the provision of mechanisms for synchronization, communication and deadlock
handling for processes.
2
 Informally, as mentioned earlier, a process is a program in execution. A process is more than the
program code, which is sometimes known as the text section. It also includes the current activity, as
represented by the value of the program counter and the contents of the processor's registers.
 A process generally also includes the process stack, which contains temporary data (such as function
parameters, return addresses, and local variables), and a data section, which contains global variables.
 A process may also include a heap, which is memory that is dynamically allocated during process run
time.
 The structure of a process in memory is shown in Figure 3.1.
 We emphasize that a program by itself is not a process; a program is a passive entity, such as a file
containing a list of instructions stored on disk (often called an executable file), whereas a process is an
active entity, with a program counter specifying the next instruction to execute and a set of associated
resources.
 A program becomes a process when an executable file is loaded into memory.
 Two common techniques for loading executable files are double-clicking an icon representing the
executable file and entering the name of the executable file on the command line (as in prog. exe or a.
out.). 3
4
 As a process executes, it changes state. The state of a process is defined in part by the current
activity of that process. Each process may be in one of the following states:
 New: The process is being created.
 Running: Instructions are being executed.
 Waiting: The process is waiting for some event to occur (such as an I/O completion or
reception of a signal).
 Ready: The process is waiting to be assigned to a processor.
 Terminated: The process has finished execution.
 These names are arbitrary, and they vary across operating systems. The states that they
represent are found on all systems, however. Certain operating systems also more finely
delineate process states. It is important to realize that only one process can be running on
any processor at any instant. Many processes may be ready and waiting, however. The state
diagram corresponding to these states is presented in Figure 3.2.
5
6
 Each process is represented in the operating system by a process control block (PBC) also called a task
control block. A PCB is shown in Figure 3.3. It contains many pieces of information with a specific process,
including these:
 Process state: The state may be new, ready running, waiting, halted, and so on.
 Program counter: The counter indicates the address of the next instruction to be executed for this
process.
 CPU registers: The registers vary in number and type, depending on the computer architecture. They
include accumulators, index registers, stack pointers, and general-purpose registers, plus any condition-
code information. Along with the program counter, this state information must be saved when an interrupt
occurs, to allow the process to be continued correctly afterward (Figure 3.4).
 CPU-scheduling information: This information includes a process priority, pointers to scheduling queues,
and any other scheduling parameters.
 Memory-management information: This information may include such information as the value of the
base and limit registers, the page tables, or the segment tables, depending on the memory system used by
the operating system.
 Accounting information: This information includes the amount of CPU and real time used, time limits,
account numbers, job or process numbers, and so on.
 I/O status information: This information includes the list of I/O devices allocated to the process, a list of
open files, and so on.
 In brief the PCB simply serves as the repository for any information that may vary from process to process.
7
8
 A process is a program that performs a single thread of execution.
 For example, when a process is running a word-processor program, a single thread of instructions is
being executed.
 This single thread of control allows the process to perform only one task at one time.
 The user cannot simultaneously type in characters and run the spell checker within the same process,
for example.
 Many modern operating systems have extended the process concept to allow a process to have
multiple threads of execution and thus to perform more than one task at a time.
 On a system that supports threads, the PCB is expanded to include information for each thread. Other
changes throughout the system are also needed to support threads.
9
 Interrupts cause the operating system to change a CPU from its current task and to run a kernel routine.
 Such operations happen frequently on general-purpose systems.
 When an interrupt occurs, the system needs to save the current context of the process running on the CPU
so that it can restore that context when its processing is done, essentially suspending the process and then
resuming it.
 The context is represented in the PCB of the process; it includes the value of the CPU registers, the process
state (see Figure 3.2), and memory-management information.
 Generically, we perform a save state of the current state of the CPU, be it in kernel or user mode, and then a
state restore to resume operations.
 Switching the CPU to another process requires performing a state save of the current process and a state
restore of a different process.
 This task is known as Context Switch.
 When a context switch occurs, the kernel saves the context of the old process in its PCB and loads the saved
context of the new process scheduled to run.
 Context-switch time is pure overhead, because the system does no useful work while switching.
 Its speed varies from machine to machine, depending on the memory speed, the number of registers that
must be copied, and the existence of special instructions (such as a single instruction to load or store all
registers).
10
 Typical speeds are a few milliseconds. Context-switch times are highly dependent on hardware
support.
 For instance, some processors (such as the Sun UltraSPARC) provide multiple sets of registers.
 A context switch here simply requires changing the pointer to the current register set.
 Of course, if there are more active processes than there are register sets, the system resorts to copying
register data to and from memory, as before.
 Also, the more complex the operating system, the more work must be done during a context switch.
 Advanced memory-management techniques may require extra data to be switched with each context.
 For instance, the address space of the current process must be preserved as the space of the next task
is prepared for use.
 How the address space is preserved, and what amount of work is needed to preserve it, depend on the
memory-management method of the operating system.
11
12
 Processes executing concurrently in the operating system may be either independent processes or
cooperating processes.
 A process is independent if it cannot affect or be affected by the other processes executing in the
system.
 Any process that does not share data with any other process is independent.
 A process is cooperating if it can affect or be affected by the other processes executing in the system.
 Clearly, any process that shares data with other processes is a cooperating process.
 There are several reasons for providing an environment that allows process cooperation:
 Information sharing: Since several users may be interested in the same piece of information (for
instance, a shared file), we must provide an environment to allow concurrent access to such
information.
 Computation speedup: If we want a particular task to run faster, we must break it into subtasks, each
of which will be executing in parallel with the others. Notice that such a speedup can be achieved
only if the computer has multiple processing elements (such as CPUs or I/O channels).
 Modularity: We may want to construct the system in a modular fashion, dividing the system functions
into separate processes or threads.
13
 Convenience: Even an individual user may work on many tasks at the same time. For instance, a user may
be editing, printing, and compiling in parallel.
 Cooperating processes require an Interprocess communication (IPC) mechanism that will allow them to
exchange data and information.
 There are two fundamental models of Interprocess communication: (1) shared memory and (2) message
passing.
 In the shared-memory model, a region of memory that is shared by cooperating processes is established.
Processes can then exchange information by reading and writing data to the shared region.
 In the message passing model, communication takes place by means of messages exchanged between the
cooperating processes. The two communications models are contrasted in Figure 3.13 below.
 Both of the models just discussed are common in operating systems, and many systems implement both.
 Message passing is useful for exchanging smaller amounts of data, because no conflicts need be avoided.
 Message passing is also easier to implement than is shared memory for inter computer communication.
 Shared memory allows maximum speed and convenience of communication. Shared memory is faster than
message passing, as message passing systems are typically implemented using system calls and thus
require the more time-consuming task of kernel intervention.
 In contrast, in shared memory systems, system calls are required only to establish shared-memory regions.
Once shared memory is established, all accesses are treated as routine memory accesses, and no assistance
from the kernel is required.
14
15

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Multithreading
MultithreadingMultithreading
Multithreading
 
Boot process
Boot processBoot process
Boot process
 
6 multiprogramming & time sharing
6 multiprogramming & time sharing6 multiprogramming & time sharing
6 multiprogramming & time sharing
 
CS6401 OPERATING SYSTEMS Unit 2
CS6401 OPERATING SYSTEMS Unit 2CS6401 OPERATING SYSTEMS Unit 2
CS6401 OPERATING SYSTEMS Unit 2
 
Introduction of Memory Management
Introduction of Memory Management Introduction of Memory Management
Introduction of Memory Management
 
The process states
The process statesThe process states
The process states
 
Memory management
Memory managementMemory management
Memory management
 
Operating system structures
Operating system structuresOperating system structures
Operating system structures
 
Process of operating system
Process of operating systemProcess of operating system
Process of operating system
 
Ch4 memory management
Ch4 memory managementCh4 memory management
Ch4 memory management
 
Introduction to System Calls
Introduction to System CallsIntroduction to System Calls
Introduction to System Calls
 
Process management in os
Process management in osProcess management in os
Process management in os
 
Operating System-Threads-Galvin
Operating System-Threads-GalvinOperating System-Threads-Galvin
Operating System-Threads-Galvin
 
VTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERS
VTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERSVTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERS
VTU 5TH SEM CSE OPERATING SYSTEMS SOLVED PAPERS
 
5. spooling and buffering
5. spooling and buffering 5. spooling and buffering
5. spooling and buffering
 
Os Threads
Os ThreadsOs Threads
Os Threads
 
Chapter 2 - Operating System Structures
Chapter 2 - Operating System StructuresChapter 2 - Operating System Structures
Chapter 2 - Operating System Structures
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)
 
Mainframe systems
Mainframe systemsMainframe systems
Mainframe systems
 

Semelhante a Operating system - Process and its concepts

operating system for computer engineering ch3.ppt
operating system for computer engineering ch3.pptoperating system for computer engineering ch3.ppt
operating system for computer engineering ch3.pptgezaegebre1
 
Operating system
Operating systemOperating system
Operating systemMark Muhama
 
Operating System-Concepts of Process
Operating System-Concepts of ProcessOperating System-Concepts of Process
Operating System-Concepts of ProcessShipra Swati
 
Operating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - EngineeringOperating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - EngineeringYogesh Santhan
 
Chapter 1 Introduction to Operating System Concepts
Chapter 1 Introduction to Operating System ConceptsChapter 1 Introduction to Operating System Concepts
Chapter 1 Introduction to Operating System ConceptsMeenalJabde
 
OS - Ch1
OS - Ch1OS - Ch1
OS - Ch1sphs
 
Chapter 1 - Introduction
Chapter 1 - IntroductionChapter 1 - Introduction
Chapter 1 - IntroductionWayne Jones Jnr
 
Operating systems. replace ch1 with numbers for next chapters
Operating systems. replace ch1 with numbers for next chaptersOperating systems. replace ch1 with numbers for next chapters
Operating systems. replace ch1 with numbers for next chapterssphs
 
operating system over view.ppt operating sysyems
operating system over view.ppt operating sysyemsoperating system over view.ppt operating sysyems
operating system over view.ppt operating sysyemsJyoReddy9
 
Basics of Operating System
Basics of Operating SystemBasics of Operating System
Basics of Operating SystemSoumit Ghosh
 
os assignment -individual presenation.pptx
os assignment -individual presenation.pptxos assignment -individual presenation.pptx
os assignment -individual presenation.pptxEngrAliSarfrazSiddiq
 

Semelhante a Operating system - Process and its concepts (20)

Os
OsOs
Os
 
Os
OsOs
Os
 
operating system for computer engineering ch3.ppt
operating system for computer engineering ch3.pptoperating system for computer engineering ch3.ppt
operating system for computer engineering ch3.ppt
 
Operating system
Operating systemOperating system
Operating system
 
Ch03- PROCESSES.ppt
Ch03- PROCESSES.pptCh03- PROCESSES.ppt
Ch03- PROCESSES.ppt
 
UNIT - 3 PPT(Part- 1)_.pdf
UNIT - 3 PPT(Part- 1)_.pdfUNIT - 3 PPT(Part- 1)_.pdf
UNIT - 3 PPT(Part- 1)_.pdf
 
Operating System-Concepts of Process
Operating System-Concepts of ProcessOperating System-Concepts of Process
Operating System-Concepts of Process
 
Operating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - EngineeringOperating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - Engineering
 
Chapter 1 Introduction to Operating System Concepts
Chapter 1 Introduction to Operating System ConceptsChapter 1 Introduction to Operating System Concepts
Chapter 1 Introduction to Operating System Concepts
 
Operating system
Operating systemOperating system
Operating system
 
OS - Ch1
OS - Ch1OS - Ch1
OS - Ch1
 
Chapter 1 - Introduction
Chapter 1 - IntroductionChapter 1 - Introduction
Chapter 1 - Introduction
 
Operating systems. replace ch1 with numbers for next chapters
Operating systems. replace ch1 with numbers for next chaptersOperating systems. replace ch1 with numbers for next chapters
Operating systems. replace ch1 with numbers for next chapters
 
Chapter 3.pdf
Chapter 3.pdfChapter 3.pdf
Chapter 3.pdf
 
UNIT II.pptx
UNIT II.pptxUNIT II.pptx
UNIT II.pptx
 
operating system over view.ppt operating sysyems
operating system over view.ppt operating sysyemsoperating system over view.ppt operating sysyems
operating system over view.ppt operating sysyems
 
Basics of Operating System
Basics of Operating SystemBasics of Operating System
Basics of Operating System
 
os assignment -individual presenation.pptx
os assignment -individual presenation.pptxos assignment -individual presenation.pptx
os assignment -individual presenation.pptx
 
PROJECT 3.pptx
PROJECT 3.pptxPROJECT 3.pptx
PROJECT 3.pptx
 
OS-Process.pdf
OS-Process.pdfOS-Process.pdf
OS-Process.pdf
 

Mais de Karan Thakkar

Theory of Computer Science - Post Correspondence Problem
Theory of Computer Science - Post Correspondence ProblemTheory of Computer Science - Post Correspondence Problem
Theory of Computer Science - Post Correspondence ProblemKaran Thakkar
 
Working principle of Turing machine
Working principle of Turing machineWorking principle of Turing machine
Working principle of Turing machineKaran Thakkar
 
Microcontoller and Embedded System
Microcontoller and Embedded SystemMicrocontoller and Embedded System
Microcontoller and Embedded SystemKaran Thakkar
 
Search Engine Optimization
Search Engine OptimizationSearch Engine Optimization
Search Engine OptimizationKaran Thakkar
 

Mais de Karan Thakkar (7)

Wt module 2
Wt module 2Wt module 2
Wt module 2
 
DBMS
DBMSDBMS
DBMS
 
Theory of Computer Science - Post Correspondence Problem
Theory of Computer Science - Post Correspondence ProblemTheory of Computer Science - Post Correspondence Problem
Theory of Computer Science - Post Correspondence Problem
 
Working principle of Turing machine
Working principle of Turing machineWorking principle of Turing machine
Working principle of Turing machine
 
Turing machine
Turing machine Turing machine
Turing machine
 
Microcontoller and Embedded System
Microcontoller and Embedded SystemMicrocontoller and Embedded System
Microcontoller and Embedded System
 
Search Engine Optimization
Search Engine OptimizationSearch Engine Optimization
Search Engine Optimization
 

Último

Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 

Último (20)

Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 

Operating system - Process and its concepts

  • 2.  A process can be thought of as a program in execution.  A process will need certain resources-such as CPU time, memory, files, and I/O devices-to accomplish its task.  These resources are allocated to the process either when it is created or while it is executing.  A process is the unit of work in most systems.  Systems consist of a collection of processes: Operating-system processes execute system code, and user processes execute user code. All these processes may execute concurrently.  Although traditionally a process contained only a single thread of control as it ran, most modem operating systems now support processes that have multiple threads.  The operating system is responsible for the following activities in connection with process and thread management: the creation and deletion of both user and system processes; the scheduling of processes; and the provision of mechanisms for synchronization, communication and deadlock handling for processes. 2
  • 3.  Informally, as mentioned earlier, a process is a program in execution. A process is more than the program code, which is sometimes known as the text section. It also includes the current activity, as represented by the value of the program counter and the contents of the processor's registers.  A process generally also includes the process stack, which contains temporary data (such as function parameters, return addresses, and local variables), and a data section, which contains global variables.  A process may also include a heap, which is memory that is dynamically allocated during process run time.  The structure of a process in memory is shown in Figure 3.1.  We emphasize that a program by itself is not a process; a program is a passive entity, such as a file containing a list of instructions stored on disk (often called an executable file), whereas a process is an active entity, with a program counter specifying the next instruction to execute and a set of associated resources.  A program becomes a process when an executable file is loaded into memory.  Two common techniques for loading executable files are double-clicking an icon representing the executable file and entering the name of the executable file on the command line (as in prog. exe or a. out.). 3
  • 4. 4
  • 5.  As a process executes, it changes state. The state of a process is defined in part by the current activity of that process. Each process may be in one of the following states:  New: The process is being created.  Running: Instructions are being executed.  Waiting: The process is waiting for some event to occur (such as an I/O completion or reception of a signal).  Ready: The process is waiting to be assigned to a processor.  Terminated: The process has finished execution.  These names are arbitrary, and they vary across operating systems. The states that they represent are found on all systems, however. Certain operating systems also more finely delineate process states. It is important to realize that only one process can be running on any processor at any instant. Many processes may be ready and waiting, however. The state diagram corresponding to these states is presented in Figure 3.2. 5
  • 6. 6
  • 7.  Each process is represented in the operating system by a process control block (PBC) also called a task control block. A PCB is shown in Figure 3.3. It contains many pieces of information with a specific process, including these:  Process state: The state may be new, ready running, waiting, halted, and so on.  Program counter: The counter indicates the address of the next instruction to be executed for this process.  CPU registers: The registers vary in number and type, depending on the computer architecture. They include accumulators, index registers, stack pointers, and general-purpose registers, plus any condition- code information. Along with the program counter, this state information must be saved when an interrupt occurs, to allow the process to be continued correctly afterward (Figure 3.4).  CPU-scheduling information: This information includes a process priority, pointers to scheduling queues, and any other scheduling parameters.  Memory-management information: This information may include such information as the value of the base and limit registers, the page tables, or the segment tables, depending on the memory system used by the operating system.  Accounting information: This information includes the amount of CPU and real time used, time limits, account numbers, job or process numbers, and so on.  I/O status information: This information includes the list of I/O devices allocated to the process, a list of open files, and so on.  In brief the PCB simply serves as the repository for any information that may vary from process to process. 7
  • 8. 8
  • 9.  A process is a program that performs a single thread of execution.  For example, when a process is running a word-processor program, a single thread of instructions is being executed.  This single thread of control allows the process to perform only one task at one time.  The user cannot simultaneously type in characters and run the spell checker within the same process, for example.  Many modern operating systems have extended the process concept to allow a process to have multiple threads of execution and thus to perform more than one task at a time.  On a system that supports threads, the PCB is expanded to include information for each thread. Other changes throughout the system are also needed to support threads. 9
  • 10.  Interrupts cause the operating system to change a CPU from its current task and to run a kernel routine.  Such operations happen frequently on general-purpose systems.  When an interrupt occurs, the system needs to save the current context of the process running on the CPU so that it can restore that context when its processing is done, essentially suspending the process and then resuming it.  The context is represented in the PCB of the process; it includes the value of the CPU registers, the process state (see Figure 3.2), and memory-management information.  Generically, we perform a save state of the current state of the CPU, be it in kernel or user mode, and then a state restore to resume operations.  Switching the CPU to another process requires performing a state save of the current process and a state restore of a different process.  This task is known as Context Switch.  When a context switch occurs, the kernel saves the context of the old process in its PCB and loads the saved context of the new process scheduled to run.  Context-switch time is pure overhead, because the system does no useful work while switching.  Its speed varies from machine to machine, depending on the memory speed, the number of registers that must be copied, and the existence of special instructions (such as a single instruction to load or store all registers). 10
  • 11.  Typical speeds are a few milliseconds. Context-switch times are highly dependent on hardware support.  For instance, some processors (such as the Sun UltraSPARC) provide multiple sets of registers.  A context switch here simply requires changing the pointer to the current register set.  Of course, if there are more active processes than there are register sets, the system resorts to copying register data to and from memory, as before.  Also, the more complex the operating system, the more work must be done during a context switch.  Advanced memory-management techniques may require extra data to be switched with each context.  For instance, the address space of the current process must be preserved as the space of the next task is prepared for use.  How the address space is preserved, and what amount of work is needed to preserve it, depend on the memory-management method of the operating system. 11
  • 12. 12
  • 13.  Processes executing concurrently in the operating system may be either independent processes or cooperating processes.  A process is independent if it cannot affect or be affected by the other processes executing in the system.  Any process that does not share data with any other process is independent.  A process is cooperating if it can affect or be affected by the other processes executing in the system.  Clearly, any process that shares data with other processes is a cooperating process.  There are several reasons for providing an environment that allows process cooperation:  Information sharing: Since several users may be interested in the same piece of information (for instance, a shared file), we must provide an environment to allow concurrent access to such information.  Computation speedup: If we want a particular task to run faster, we must break it into subtasks, each of which will be executing in parallel with the others. Notice that such a speedup can be achieved only if the computer has multiple processing elements (such as CPUs or I/O channels).  Modularity: We may want to construct the system in a modular fashion, dividing the system functions into separate processes or threads. 13
  • 14.  Convenience: Even an individual user may work on many tasks at the same time. For instance, a user may be editing, printing, and compiling in parallel.  Cooperating processes require an Interprocess communication (IPC) mechanism that will allow them to exchange data and information.  There are two fundamental models of Interprocess communication: (1) shared memory and (2) message passing.  In the shared-memory model, a region of memory that is shared by cooperating processes is established. Processes can then exchange information by reading and writing data to the shared region.  In the message passing model, communication takes place by means of messages exchanged between the cooperating processes. The two communications models are contrasted in Figure 3.13 below.  Both of the models just discussed are common in operating systems, and many systems implement both.  Message passing is useful for exchanging smaller amounts of data, because no conflicts need be avoided.  Message passing is also easier to implement than is shared memory for inter computer communication.  Shared memory allows maximum speed and convenience of communication. Shared memory is faster than message passing, as message passing systems are typically implemented using system calls and thus require the more time-consuming task of kernel intervention.  In contrast, in shared memory systems, system calls are required only to establish shared-memory regions. Once shared memory is established, all accesses are treated as routine memory accesses, and no assistance from the kernel is required. 14
  • 15. 15