Is it unsafe to call methods from a thread?

Suppose that a UNIX kernel supports threads. would u expect the thread system call to take about the same amou

  • suppose that a UNIX kernel supports threads. would u expect the thread system call to take about the same amount of time to execute as fork()?Why and why not?

  • Answer:

    Actually, a call to create a thread should (provided it were written properly) take less time to spawn a new thread. The fork() function, however, actually spawns a new process. The difference between processes and threads is that a process is a thread which contains all of the resources that are used by the applications. Therefore, you have a "thread" and you have a "thread plus resources" (process). Because there is extra setup time involved in setting up the resources for the process, the fork() call would take more time in setting up a process than it would a thread.

thanhngu... at Yahoo! Answers Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.