Process Management (Processes and Threads)

Neso Academy
29 Jun 201807:32

Summary

TLDRThis lecture delves into the fundamentals of process and thread management within operating systems. It begins by explaining the transition of a program from high-level code to machine-executable binary, facilitated by compilers. The operating system's role in loading programs into memory and allocating resources is highlighted. A process is defined as a program in execution, with the ability for modern computers to manage multiple processes simultaneously. Threads are introduced as the execution units within a process, which can range from single to multiple per process. The lecture clarifies the distinction between processes and threads, using visual examples from task managers and process explorers to illustrate their presence and function in a system.

Takeaways

  • 📚 The script introduces the concept of process management as a crucial part of operating systems.
  • 🔍 It clarifies the confusion between processes and threads, aiming to provide an understanding of both.
  • 💻 A program is initially written in a high-level language and must be compiled into machine code for the computer to execute.
  • 🔄 The operating system plays a vital role in loading the program into memory and allocating necessary resources for execution.
  • 🚀 A program becomes a process when it starts execution, transitioning from a passive to an active state.
  • 🌐 Modern computers support the concurrent execution of multiple processes and even multiple processes within a single program.
  • 🧵 A thread is defined as the basic unit of execution within a process, which can range from one to many within a single process.
  • 📈 The script uses a diagram to visually differentiate between a process and its constituent threads.
  • 🖥️ Windows Task Manager can be used to view the processes currently running on a system.
  • 🔎 Process Explorer provides a deeper insight by showing threads associated with each process and program.
  • 🔮 The lecture concludes with an emphasis on the importance of processes in operating systems and a teaser for more detailed study in future lectures.

Q & A

  • What is the primary role of an operating system in managing a program?

    -The primary role of an operating system in managing a program is to load the executable program into memory, allocate necessary resources, and facilitate its execution.

  • What is the difference between a high-level language and machine code?

    -A high-level language is a programming language that is easier for humans to understand and write, such as C, C++, or Java. Machine code, on the other hand, is the binary code (0's and 1's) that a computer's hardware can understand and execute directly.

  • What tool is used to convert a high-level language program into machine code?

    -A compiler is used to convert a high-level language program into machine code that can be executed by a computer.

  • What is the definition of a process in the context of operating systems?

    -A process is a program in execution. It becomes active when the program begins to run, utilizing system resources and performing tasks.

  • How does a modern computer differ from earlier computers in terms of process management?

    -Modern computers can support multiple processes or programs running at the same time, whereas earlier computers typically supported only one process or program at a time.

  • What is a thread in relation to a process?

    -A thread is the basic unit of execution within a process. It represents a sequence of instructions that can be executed independently within the context of a process.

  • How many threads can a process have?

    -A process can have anywhere from one thread to many threads, depending on the complexity and requirements of the program.

  • What is the purpose of the Task Manager in Windows?

    -The Task Manager in Windows allows users to view the processes and programs currently running on the system, along with details such as memory usage.

  • How can one view the threads associated with a process in Windows?

    -One can use a program like Process Explorer to view the threads associated with each process. It provides detailed information about the execution units within a process.

  • What is an example of a single program that can have multiple processes?

    -The Chromium browser is an example of a single program that can have multiple processes, as shown in the script with multiple instances of chrome.exe running.

  • What is the significance of understanding processes and threads in operating systems?

    -Understanding processes and threads is crucial as it forms the basis for managing and optimizing system resources, ensuring efficient execution of programs, and studying more advanced topics in operating systems.

Outlines

00:00

📚 Introduction to Process Management

This paragraph introduces the concept of process management, a critical component of operating systems. It explains the transition from a passive program to an active process when execution begins. The paragraph clarifies the distinction between processes and threads, emphasizing that a process is essentially a program in execution, potentially consisting of multiple threads. It also touches on the evolution from single-process systems to modern computers that support multiple processes and threads. The role of the operating system in resource allocation and program execution is highlighted, setting the stage for a deeper exploration of these concepts in subsequent lectures.

05:03

🔍 Exploring Processes and Threads in Action

This paragraph delves deeper into the practical aspects of processes and threads, illustrating how they can be observed in a modern operating system. It uses the example of the Chromium browser to demonstrate that a single application can have multiple associated processes, each consuming system resources. The paragraph introduces tools like the Windows Task Manager and Process Explorer to visually inspect running processes and their constituent threads. The summary underscores the multi-threaded nature of modern applications and the importance of understanding these concepts for a deeper grasp of operating systems. It concludes with an invitation to further study these topics in future lectures, reinforcing the significance of process and thread management in the field of computer science.

Mindmap

Keywords

💡Operating System

An operating system is the software that manages computer hardware and software resources and provides common services for computer programs. It is the core component of a computer system, handling the execution of various processes and the management of system resources. In the script, the operating system is central to the discussion of process and thread management, emphasizing its role in loading programs into memory and allocating necessary resources for execution.

💡Process

A process is a program in execution. It is an active entity that is currently running within the computer's memory, utilizing CPU time and other system resources. The script explains that a process is created when a program begins execution and is the fundamental unit of work in a system, with the ability to support multiple processes or programs running simultaneously.

💡Thread

A thread is the smallest unit of processing that can be scheduled by an operating system. It represents a separate path of execution within a process and can be used to perform concurrent operations within the same program. The script clarifies that threads are the basic units of execution within a process, allowing for multiple threads to operate within a single process, enhancing efficiency and responsiveness.

💡Program

A program is a sequence of instructions written in a programming language that performs a specific task when executed. The script describes the process of developing a program, starting from writing in a high-level language to compiling it into machine code, which is then ready for execution by the computer.

💡Compiler

A compiler is a special software that translates code written in a high-level programming language into machine code that a computer's processor can execute. In the script, the compiler is mentioned as the tool that converts a high-level language program into binary code, making it understandable and executable by the computer.

💡Binary Code

Binary code is a system of numerical notation used in digital computing, consisting of 0s and 1s, which represent the two possible states of a computer's memory or processor. The script explains that a program must be converted into binary code to be executed by the computer, as this is the language that the computer's hardware understands.

💡Memory

Memory, in the context of computing, refers to the hardware components that store data and instructions for the processor to execute. The script mentions that a program must be loaded into memory to be executed and that the operating system is responsible for managing this process.

💡Task Manager

Task Manager is a utility in Windows operating systems that provides a view of the computer's processes, allowing users to see which programs are currently running and manage their performance. The script uses Task Manager as an example to show viewers how to observe the processes running on their system.

💡Process Explorer

Process Explorer is a software utility that provides detailed information about the processes and threads running on a system, offering more visibility than the standard Task Manager. The script introduces Process Explorer as a tool to view not only the processes but also the individual threads within each process.

💡Chromium Browser

The Chromium browser is an example used in the script to illustrate the concept of multiple processes associated with a single application. It demonstrates how a single program can have multiple processes, each potentially with multiple threads, running concurrently.

💡Execution

Execution in computing refers to the process of running a program or process, where the computer's processor performs the operations specified by the program's instructions. The script discusses execution in the context of transforming a passive program into an active process, highlighting the transition from a static entity to an operational one.

Highlights

Introduction to the concept of process management in operating systems.

Clarification of the common confusion between processes and threads.

Explanation of how a program is developed from high-level languages to machine code using a compiler.

The necessity of converting high-level language programs into binary code for machine execution.

The role of the operating system in loading programs into memory and allocating resources.

Definition of a process as a program in execution.

Historical context of early computers supporting only one process at a time versus modern computers supporting multiple processes.

Description of threads as the basic unit of execution within a process.

The possibility of a single process having multiple threads for concurrent execution.

Visual representation of processes and threads using a diagram for better understanding.

Practical demonstration of viewing active processes using the Windows Task Manager.

Example of multiple processes associated with a single program, such as the Chromium browser.

Introduction of Process Explorer as a tool to view threads within processes.

Demonstration of using Process Explorer to view threads associated with a specific process.

Importance of understanding processes and threads for further study in operating systems.

Anticipation of more detailed study of processes and related topics in upcoming lectures.

Conclusion and invitation to the next lecture for further exploration of process management.

Transcripts

play00:00

In the previous lectures we have been studying about

play00:02

different aspects of operating system.

play00:04

And what we had mostly seen was

play00:06

the introduction to operating system and also operating system structures.

play00:10

Now, moving on to one of the most important part of operating system

play00:15

which is process management.

play00:17

You must have heard this term many times processes and threads.

play00:21

So, in this lecture we will be trying to get an introductory idea

play00:25

and understanding of what are processes and threads.

play00:28

And usually people are confused many times between the processes and threads.

play00:34

So, we will try to understand what these are and what are their differences.

play00:39

So, first of all before we understand processes,

play00:42

let us first try to understand how a program is developed.

play00:46

So, whenever you want to make a program,

play00:49

what you do is,

play00:50

you first write the program in some high level languages.

play00:53

For example, let's say you write the program in C,

play00:56

C++, JAVA or something like that.

play00:58

And that program is written in a high level language.

play01:01

Now, we know at the basic level

play01:03

computer does not understand the high level language.

play01:05

But it understands only the binary codes, which are 0's and 1's.

play01:09

So, the program has to be converted to binary code.

play01:13

So, for that using a compiler, you compile your program and it helps to

play01:17

convert that program into machine code which is understandable by your machine.

play01:22

Alright!

play01:23

So, after that you have your program

play01:25

which is converted into a binary executable code

play01:29

and it is ready for execution.

play01:30

But it is not enough to just have that binary code for a program to execute

play01:35

or for a program to tell the computer what it wants to do.

play01:39

So, what it has to do is,

play01:40

it has to be loaded into the memory,

play01:42

and for a program to execute, it needs some resources of the computer system.

play01:48

So, who will allocate the resources?

play01:51

What is the brain that works behind all these?

play01:53

It is the operating system, which we have been discussing so far.

play01:57

So, the operating system will help in loading that executable program

play02:01

into the memory and allocate its resources

play02:04

and then the program will begin its execution.

play02:07

Alright!

play02:07

So, we first have a program which is written and is ready for execution

play02:12

but till that time it is just a passive entity.

play02:16

That means it just sit there without doing anything.

play02:19

But the moment it begins execution, at that instance

play02:23

we call that program as a process.

play02:26

So, a process can be thought of as a program in execution.

play02:31

When a program starts execution, at that time we call it a process.

play02:36

So, when it is not executing, it is just a program sitting there and doing nothing.

play02:41

But the moment it begins execution, at that time we call it a process.

play02:46

So, in the earlier computers

play02:48

it supported only one process or one program at a time.

play02:52

But in today's computer it supports

play02:54

multiple processes or programs running at the same time.

play02:58

And even one single program can have many processes associated with it.

play03:03

So, when a program begins its execution at that time it is known as the process.

play03:08

So, now let's try to understand what are threads?

play03:10

So, thread is actually the basic unit of a process which is in execution.

play03:17

So, this is how we can define it.

play03:18

A thread is the unit of execution within a process.

play03:22

A process can have anywhere from just one thread to many threads.

play03:26

So, we already understood what is a process?

play03:28

When a program is executing it is called a process.

play03:31

And a thread is the unit of execution within a process.

play03:35

So, within a process there may be one or more units of its execution

play03:40

and those units are known as threads.

play03:43

And again in earlier systems,

play03:45

one process had only thread.

play03:47

But now a single process has many threads or many units of execution within it.

play03:53

So, a process can have anywhere from one thread to many threads.

play03:57

So, that is the difference between a process and a thread.

play04:01

If you look at this diagram,

play04:02

I hope you should be able to visualize and understand what it actually means.

play04:07

So, here we call this entire thing as a process.

play04:10

When a program begins its executions, it becomes the process.

play04:13

And within this process there are certain units of executions.

play04:18

And each unit is known as a thread.

play04:20

So, these are all the units or the threads,

play04:23

which are under execution within this process.

play04:26

Now if you want to see the processes which are in execution in your system,

play04:29

you can see it by using your task manager in your Windows.

play04:32

You can open up the task manager,

play04:34

and you can see which are the programs that are loaded

play04:37

and what are the process that are executing.

play04:40

So, let me how you an example of that.

play04:42

So, here this is a screen shot of my 'task manager'.

play04:45

If you open up your task manager and look at this application tab,

play04:49

we can see which are the programs that are running.

play04:52

So, here I have three programs running over here.

play04:54

And here we have the 'processes' tab.

play04:56

so, if you click on the 'processes' tab,

play04:58

you can see what are the processes running in your system.

play05:02

So, if you click this, you come to this window over here,

play05:06

where you can see that there are all these processes are running in your system.

play05:10

So, for example if you look here

play05:12

you can see that there is Chromium browser running over here.

play05:15

And if you look at the processes tab,

play05:17

we see that there is not only one process associated with this

play05:22

chromium browser but there are multiple processes.

play05:25

For example you can see there is chrome.exe here.

play05:28

It is also here.

play05:30

There are quite a few events over here.

play05:32

So, we see that

play05:33

there are multiple processes associated with a single program.

play05:37

And this is the memory that it is using which is shown over here.

play05:41

So, this is just an example

play05:42

of how you can see the program and processes running in your system.

play05:46

Because if you see what is happening,

play05:48

it become more interesting for you to learn and understand

play05:51

what is happening.

play05:52

So, here we have seen the processes.

play05:54

But we did not see any threads over here.

play05:57

So, if you want to see the threads that are also there in your system,

play06:00

then you can use a program known as process explorer.

play06:04

You can download that program

play06:05

and it wiill show you even the threads that are running

play06:08

for each program and for each process.

play06:11

So, this is how the process explorer looks like.

play06:13

You can download this.

play06:14

It is a very small application.

play06:16

You can download and install it.

play06:18

And you can see that these are the processes as we saw before.

play06:21

So, for example,

play06:23

here I have the chrome.exe process running over here.

play06:26

And if you right click on this and go to the properties

play06:29

then you can see the threads.

play06:31

So, here you will get this window

play06:33

and if you click on this threads tab,

play06:35

you can see that these are the threads,

play06:37

which are the unit of execution for this particular process

play06:41

and which are running over here.

play06:43

So, these many threads are running within this process chrome.exe.

play06:49

So, in this way you can see

play06:51

the processes and the threads that are running in your system.

play06:53

So, I hope with this visual example

play06:55

it was more clear to you,

play06:57

what are processes?

play06:58

And what are threads?

play06:59

And how they work.

play07:01

So, this was just and basic introduction of

play07:03

what are processes and what are threads.

play07:05

And how we can differentiate between a process and a thread.

play07:08

So, this process is a very important topic in operating system.

play07:12

And we will be studying this in more details

play07:14

and many topics are there under this

play07:16

which we will be discussing in the coming lectures.

play07:18

Thank you for watching and see you in the next one.

Rate This

5.0 / 5 (0 votes)

Связанные теги
Operating SystemsProcess ManagementThreadsProgram ExecutionSystem ResourcesTask ManagerProcess ExplorerBinary CodeCompilerMultithreading
Вам нужно краткое изложение на английском?