Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


what is the difference between fork and thread ?
and parent and child process in fork system call?

Answers were Sorted based on User's Feedback



what is the difference between fork and thread ? and parent and child process in fork system call?..

Answer / amith

fork() system call in UNIX causes creation of a new process
the new process (child process) which is an exact copy of
the calling process(parent process).return value from fork
() is used to distinguish the parent from the child; the
parent receives the child's process id, but the child
receives zero.

A thread is a stream of instructions that can be scheduled
as an independent unit.

A thread is a stream of instructions that can be scheduled
as an independent unit. It is important to understand the
difference between a thread and a process. A process
contains two kinds of information: resources that are
available to the entire process such as program
instructions, global data and working directory, and
schedulable entities, which include program counters and
stacks. A thread is an entity within a process that
consists of the schedulable part of the process.

A fork() duplicates all the threads of a process. The
problem with this is that fork() in a process where threads
work with external resources may corrupt those resources
(e.g., writing duplicate records to a file) because neither
thread may know that the fork() has occurred.

When a new perl thread is created, all the data associated
with the current thread is copied to the new thread, and is
subsequently private to that new thread! This is similar in
feel to what happens when a UNIX process forks, except that
in this case, the data is just copied to a different part
of memory within the same process rather than a real fork
taking place.

A fork() induces a parent-child relationship between two
processes. Thread creation induces a peer relationship
between all the threads of a process.

Is This Answer Correct ?    25 Yes 6 No

what is the difference between fork and thread ? and parent and child process in fork system call?..

Answer / nanda

for() creates a new process which copy of parent only PID
is different.thread create within process except stack it
shares memory

example:
global variable seterrno is shared by multiple threads

Is This Answer Correct ?    13 Yes 12 No

what is the difference between fork and thread ? and parent and child process in fork system call?..

Answer / venkatamahalakshmaiah

what an answer Nanda..u shuld be kept in a museum..

Is This Answer Correct ?    7 Yes 13 No

Post New Answer

More Linux AllOther Interview Questions

How to findout, if the user is local user or NIS user in the Linux (RHEL)?

1 Answers  


As a system admin i want to know some things what are the troubleshooting issues we are facing frequently and what are the tickets will be raised.

0 Answers   Ondot,


There are 4 network Interfaces, how can we find which one is Primary.

2 Answers  


tell me some of the Linux HotKeys do you know?

3 Answers  


Through ssh whole directory structure from / is shared regardless the user we have connected with ....... how do i prevent sharing ??

4 Answers   Tech Mahindra,


How find out drivers of installed devices in linux (RHEL)?

2 Answers  


I have accidently deleted my fstab... how do i recover/ regenerate the file?????? in rescue mode i cannot create a new file since the filesystem is readonly and could not mount in readwrite mode ?????????

6 Answers   IBM,


What is the difference between RedHat linux and Fedora and Ubuntu?

3 Answers   CSC,


What is the difference between an argument and an option/switch?

3 Answers   Wipro,


what is the gate of ftp server in redhat linux?

0 Answers  


what is difference between inetd and xinetd

2 Answers  


why /etc/shadow file do not have any permission ?

0 Answers   IBM,


Categories