Software Engineer, Your next Programming Instructor.

"Here I share myself."
Showing posts with label operating system. Show all posts
Showing posts with label operating system. Show all posts

Saturday, 18 July 2020

Thread in Operating System | Thread VS Process

What is Thread in Operating System?


First of all you should know that a thread is also known as lightweight process.

It is a sequence of instruction within a process. A thread itself behave like a processes in a process.

It behave like a process within the process, but it don’t have a complete PCB it relays on the PCB of the process under which it is behaving like a process.

A process can have multiple threads, all those multiple threads in the process help the process to perform multiple executions which improves the working.

There must be at least one thread in a process.

A thread pass through three states:
  1. Running
  2. Ready
  3. Blocked 

Benefits of Threads:

It share common data and do not use the Inter process communication.

Speed improvement when multiple threads cooperate to complete a single job.

Context switching becomes fast when working with threads.

Threads use very little recourses of OS as they don’t demand complete separate PCB.

It share common data and do not use the Inter process communication.

Speed improvement when multiple threads cooperate to complete a single job.

Context switching becomes fast when working with threads.

Threads use very little recourses of OS as they don’t demand complete separate PCB.





Sunday, 5 July 2020

IPC model | Shared memory model | Message passing model in OS

Inter-Process Communication | Shared Memory Model | Message Passing Model in Operating System

Software Engineering,mysoftwarenotes.com,mysoftwarenotes,software developer,software,operating system tutorial,operating system course,ipc in operating system,ipc in operating system in hindi,shared memory model in os,message passing model in,message passing model in os,message passing model in operating system,message passing model in distributed system,symmetric communication in os,asymmetric communication is os,os in hindi easy engineering classes


•IPC – (Inter-Process Communication) is the capability which allow two process of the computer to communicate with each other.

•Where will be those process?
•Its not important for process to be in the same computer they can be in same computer or in different computer which are connected over the network.

•There are two fundamental model of Inter Process Communication.
•1) Shared Memory Model
•2) Message Passing Model

Shared Memory Model
•This model made a region of memory which get shared between the cooperating processes.

•The process who want to share information read and write the data from this location.

•This is the fast model as compare to the Message passing model.

Where this shared memory is located?

You may find this shared memory under the address space of the process which want to share data with other processes.

•Yup, That’s true that OS usually prevent the process to inter in the memory of other process but in this scenario, we bypass this prevention.
•OR the process itself allow the OS to remove this protection from its memory for the cooperating processes.

Message Passing Model
In this model two process communicate with each other by passing messages.

•It is easy to implement as compare to shared memory model.

•It is useful to exchange small amount of data.

•This system is much more useful in the distributed environment when the two computers are on the same network and their processes want to share the data.

Message Passing Model Operations:

Message passing model provide two operations
1.Send(Message)
2.Receive(Message)

In sending message and receiving message, there are two more concepts.
1.Direct Communication
    1.1.Symmetric Communication
    1.2.Asymmetric Communication
2.Indirect Communication

Direct Communication:
In direct communication sender and receiver mention the name of the process from which they want to receive messages or to whom they want to send messages.

In Symmetric communication both sender and receiver mention the name of each other.

in Asymmetric Communication Only sender mention the name of the receiver, receive the message from the ID.

Indirect Communication:
•In this system messages are sent and receive from the mailbox.

•Mailbox is a place where two or more process store and remove messages.

•Processes communicate sharing one mailbox.

Video Lecture on the Topic

Tuesday, 30 June 2020

IPC- Inter Process Communication



Inter Process Communication - IPC in Operating System
•IPC – (Inter-Process Communication) is the capability which allow two process of the computer to communicate with each other.

•Where will be those process?
•Its not important for process to be in the same computer they can be in same computer or in different computer which are connected over the network.

•IPC allow one application to control other application, It also allow two applications to share data with each other.

•IPC is an important thing in the multiprogramming system, or we can say multiprogramming system depends on this system,

•Single process Operating system do not use IPC.

•Microsoft windows is a Multiprogramming operating system and it use the IPC. In windows IPC is known as Dynamic Data Exchange System.

•In an OS (Multiprogramming OS) many process may be running at the same time. In the context of IPC we can divide those processes into two main categories.

1.Independent Process
2.Cooperating Process

Independent Process 
•As name shows in the Multiprogramming OS environment these processes are work independently.
•They never ask any other process to share data and never share their own data to some other process.
•Although they are in the Multiprogramming OS but they never share data.

Cooperating Process
•Name is telling the whole store these are just opposite to the independent process and share the data with other cooperating process into the system.

•Different advantages of process cooperation:
1.Information Sharing
2.Computation Speed up
3.Modularity
4.Convenience

Computation Speed up
•Task get divided into multiple tasks, all task run parallel and achieve the required results.

Modularity
•Divide a function into separate process and threads.

Convenience
•If user is using the same data in different tasks conflict can be arise so this system try to avoid conflicts.

•There are further two memory models in this system.
•Shared Memory Model
•Message Passing System


Sunday, 5 April 2020

Operating System Process Termination Exit(), Abort() | Zombie and Orphan process in Operating System

Zombie and Orphan Process,Operating System,Software Engineering,mysoftwarenotes.com,mysoftwarenotes,difference between zombie and orphan process,difference between zombie and orphan process in linux,zombie and orphan process difference,explain zombie and orphan processes,process termination in operating system,process creation and termination in operating system,process termination in os,what is process termination in os,types of process termination in os,OS
Operating System Process Termination

Operating System Process Termination Exit(), Abort() | Zombie and Orphan process in Operating System

In the last lecture we discussed about the process creation and Child process in details.

In this lecture we gona cover the following topics.
1. What is process termination?
2. How a child process terminates
3. What is the Orphan Process
4. What is the concept of Zombie process.

1. Process Termination:When a process startes working it have to get terminated after finishing its task this is the normal way of termination but sometime a process get hangs or a process start troubling you so you also kill the process to keep your experience smoth this is also process termination.On the termination a process gives the Exit() call to the OS so the operating system can know the process has been terminated.

2.Child process termination:
Child terminates by finishing its task and it also return the data or say results of the task to the parent process.
Parent process can also send the Abort() call to child to terminate its processing and return the data to parent.
Some time we explaing this parent child behavior with the sentence "Parent reap the child process".
The word reap means getting/Obtaining something good in the result of something you did.
I hope now you can understand what does parent reap the child means.

3. Orphan process & its types:
So child has a parent but sometime the parent get terminated so the child becomes the orphan thats is what the orphan means.A child without his parent is known as the orphan.
Now there are two different situations or say diferent types of Orphans.
Some child becomes the orphan intentionally others becomes unintentionally what does that mean?

3.1:Intentionally Orphan: Parent is busy in doing his task and child as well but the parent manages to complete his task early and want to terminates.
Normally when a parent terminates its child also terminates as well.
Here the parent has completed its task and want to terminate but the child still have a lot of work to do so the child will ask the parent dad you can get terminated I have a alot of work to do it may take some time I will terminate latter. The parent will get terminated and the child will become orphan intentionally.

3.2: Unintentionally Orphan: this is simple a child may not want his parents to get terminated like in above case but someone kills the parent.
Who and why someone kills the parent?
If a parent get hangs or create some other problems and distrub the computer user may be the end user will kill the parent to avoid the troubles in usage and there can be many more problems like this.

4. What is the Zombie process?Zombie seems like the name got inspiration from the famous movie isn't it?
So far by now what we know that a process reap its child. Some time a process forgets to reap its child. After completing the assign task child releases all the resources which it was using but keeps the ID. As every process have a unique ID and when the parent reap its child it also relese the ID which the child was holding so that other new process can use this ID.
This cycle of IDs keep going on. Process releases the ID on termination and new comers gain it.
Coming back to the topic the child do not release the ID but resources now the OS can't kill this process as it don't have any resources according to OS it is already dead. How can an OS kill the already dead process.
But it is dangerous as it is holding the ID and of processes keep holding IDs like this we may get Shortage of IDs for new process so these kind of process which are not holding the resources but ID and we can't kill them because they are already dead are known as Zombies.

Video lecture on the topic Process termination in Hindi

Thursday, 19 March 2020

Process Creation and Child Process in Operating System


Process Creation and Child Process in Operating System

Operating system is also responsible for creating the processes.

In this lecture we have discussed about how a child process get created and what is the all life cycle of child process.

So first of all it is important to know that a process may or may not create a child process.
If a process create a child process or more than one child processes.

Those child processes will use the resources or ask for the resources to the parent process and parent process will provide the resource to child process.

Parent process also have the authority to limit the usage of resources by child process or the child may ask for all the resources which a parent have.

A child have also authority to create further more childs.

Parent and child process can communicate with each other as well because they share the same memory space.