main();
{
int i,j,k;
printf("------");
abc();
i=j+k;
abc();
xyz();
}
abc()
{
}
xyz()
{
This is also in java language, but after the AWT & JFC this is not going to take place.
Using AWT & JFC, we can execute multiple tasks at the same time.
main() method is the starting of the program and the last line in your main() function is
the ending of your program
In AWT & JFC even though the main program is executed the last line, the program is still executing. This is because of something is happening at the back (O/S level) apart from our main(), i.e. something similar to the main() is executing at the back.
While he/she is answering to one call (client), the other people those who are trying the
same number will hear the engage sound, and they can't able to connect to that number
until unless he/she terminates the call i.e. at point of time telephone operator can't handle
multiple calls. (He/she can't provide concurrent service to multiple clients unless he/she
has multiple phones)
provideService(); // returns content to the Server.
}
}provideService(){
In this case, until the time is complete for the call other person cannot able to call the
same number for the same number. And if the content to be delivered is more, then also
can't work well.
A program under execution is known as process. Almost all the O/S can able to run
multiple processes at a point of time simultaneously/concurrently.
Ex: If we opened 3 Notepad applications, then at the O/S level, it is running 3 processes
of notepad concurrently.
{
Listen();
pid = fork(); // pid =process Id
if(pid != PARENT)
Child
Task Manager/Process Manager are used to know the processes details like pid and so on.
Process Table/Task Table consists the indexes of process-id's (each and every program
In our code, one processif(pid!=PARENT) is executed and becomes 0 (zero) which is a child, and in other case it cannot be zero, it is non-zero that is a parent. In child process case, it executes theprovideService() method and in the parent process it listens another call from the other client. BecauseprovideSevice() method will be skipped in the parent process, so it receives the call.
1. Writing this kind of programs is not that much easy because the separate memory is
required for each and every process.
2. Creating a process at the O/S level is very expensive on time consuming usingfork()
method. If this is going on, at some point of time, there is very less memory to execute
the program causes lower performance. This is a heavy weight component Technique.