Thread: difference between a process and a task?

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    57

    difference between a process and a task?

    Perhaps this is not the right forum to post this question and if it indeed is not, I am sorry. I tried to look up on the net/text books but could not really get convinced about the difference between a process and a task. or perhaps a better question is "whats the difference between multi processing and multi threading" (sorry for bold if it means something else than what I intended it to be.)

    I thought, multiprocessing is ummmm well..... ability to schedule multiple processes(runing image of a program) based on some time management algorithm. And multi tasking is ........


    lets say we have three process A, B and C, and CPU runs them each for say 10 units of time.

    A needs 25 units of time to complete.
    B needs 35 units of time to complete.
    C needs 30 units of time to complete.

    Lets say all the other factors remaining same, the order of execution by the CPU is A, B and C.

    CPU allocates 10 units to A first and then B and then C and then completes one more cycle of the same. So A, B and C now require 5 units, 15 units and 10 units of time respectively.

    A now has gets the CPU time and is done in 5 units of time. Now instead of resting for the next 5 units of time, CPU allocates this time to process B and then at the end of this A's allocated time, B has also completed 25 units. now the CPU allocates 10 units of time to B and B is done as well. (Multi tasking.) A picture could have explained it better.
    Now the CPU allocates time to C and C is done too.

    This is what I used to think till I started reading "Linux Kernel Programming". In the 3rd chapter, "Introduction to the kernel" (near fig 3.1) I read something which has me confused totally about the same.

    Can someone clarify this please?

    Thanks,
    Anoop.

  2. #2
    Registered User
    Join Date
    Mar 2002
    Posts
    57
    OOPS I goofed up.

    perhaps a better question is "whats the difference between multi processing and multi threading" should have been perhaps a better question is "whats the difference between multi processing and multi tasking"

    The concept of process and thread is pretty clear in my mind.

    Sorry for the confusion :>)

  3. #3
    Comment your source code! Lynux-Penguin's Avatar
    Join Date
    Apr 2002
    Posts
    533
    I agree vVv not many people read the source.

    But the idea that anyone (especially those willing) can read it and see EXACTLY how it ticks. What I do especially with larger coded projects is build a note file and take notes and line numbers down on important lines and write either C or Pseudo code for it.

    And sometimes if it is lower-level code I will rewrite it for efficiency.

    Open Sources isn't the solution and it doesn't claim to be but it is just the support of free information.

    and programmers can learn so much by looking at the examples posted in these open-source projects. And maybe one day they can add to them, which I believe is the goal of Open Source.
    Asking the right question is sometimes more important than knowing the answer.
    Please read the FAQ
    C Reference Card (A MUST!)
    Pointers and Memory
    The Essentials
    CString lib

  4. #4
    Registered User
    Join Date
    Mar 2002
    Posts
    57
    I tried to restrain myself, but I think I have the right to defend myself. While I absolutely agree with both of you that the source code is there for all to read, I would, however, add that I am not yet such a good programmer, who can understand these complex(easy for you guys perhaps) codes, without a little help. All I had done was corrected my misprinted question. And quite again, I am not sure if this is the forum for the subsequent question, but is the difference between a process and a task(or lack off it), same in linux as it is in FreeBSD(I chose it over say Solaris coz its open source)? I was talking about the difference between a process and task in a general *ix way, rather than confining it to only linux.

    Thanks for your replies.

Popular pages Recent additions subscribe to a feed