1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Threads and Processes

Discussion in 'Operating System' started by makarov, Dec 19, 2010.

  1. makarov

    makarov New Member

    Joined:
    Nov 13, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Hi guys!

    I'm really struggling to find the right answer to this questions, and maybe you guys can give an idea of what is all about.

    Can anyone briefly describes, the difference between the relationships between threads and processes in Linux and Microsoft operating systems?


    I would appreciate it, if you could answer this nightmare questions as soon as you can.

    Thanks,

    Mak
     
  2. neo_vi

    neo_vi Member

    Joined:
    Feb 1, 2008
    Messages:
    722
    Likes Received:
    15
    Trophy Points:
    18
    Occupation:
    Software engineer
    Location:
    Earth
    Home Page:
    Thread and process are considered same in Linux.
    In windows, they are different entities.

    Linux sees threads as just a sub-process. The linux method has advantages and less overhead than windows method.
     
  3. ankitasharma

    ankitasharma Banned

    Joined:
    Jul 23, 2011
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    0
    1)Threads have direct access to the data segment of its
    process; processes have their own copy of the data segment
    of the parent process.

    2)Threads share the address space of the process that
    created it; processes have their own address.

    3)Threads can directly communicate with other threads of
    its process; processes must use interprocess communication
    to communicate with sibling processes.

    4)New threads are easily created; new processes require
    duplication of the parent process.
     
  4. deadlock

    deadlock New Member

    Joined:
    Jan 16, 2012
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    neo_vi: Is this a joke? I never heard anything like that.
    Processes and threads are 2 completely different schemes, i think.
    Please provide some papers confirming these assumptions :).

    ankitasharma is already mentioning the basic things.

    Differences between windows and linux processes:
    In linux, theres a clean process tree, starting with the "init" process.
    In windows, there is apparently no process tree. Processes are addressed by a process handle. Means, window's processes are not relying on a 'clean' process tree. You can think of it as a "visual" process tree, but it' has nothing to do with the real processes.

    Linux processes are first copied with fork and then its core image is replaced with
    execv (or one of its siblings).
    In windows both goes with only one system call: CreateProcess.

    Spontaneously I don't remember any large differences between the thread-handling of these os'es.
     
  5. neo_vi

    neo_vi Member

    Joined:
    Feb 1, 2008
    Messages:
    722
    Likes Received:
    15
    Trophy Points:
    18
    Occupation:
    Software engineer
    Location:
    Earth
    Home Page:
    Not a joke. Linux just sees all the threads as a process. Everything is represented with struct task_struct structure.
     
  6. deadlock

    deadlock New Member

    Joined:
    Jan 16, 2012
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    neo_vi: Okay, got any proof for this? :]
     
  7. neo_vi

    neo_vi Member

    Joined:
    Feb 1, 2008
    Messages:
    722
    Likes Received:
    15
    Trophy Points:
    18
    Occupation:
    Software engineer
    Location:
    Earth
    Home Page:
    Linux kernel development. by Robert love.
     

Share This Page