Ask Experts Questions for FREE Help !
Ask
    kp42484's Avatar
    kp42484 Posts: 39, Reputation: 16
    Junior Member
     
    #1

    Apr 18, 2006, 06:55 AM
    Processes
    Can anyone explain why a single processor system can only have one process in the running state at a time? I've tried to find the answer in my textbooks, but they just state the obvious and don't answer why this is so. Does it have to do with scheduling? Resources?

    Thanks in advance to anyone who can reply!:)
    NeedKarma's Avatar
    NeedKarma Posts: 10,635, Reputation: 1706
    Uber Member
     
    #2

    Apr 18, 2006, 07:35 AM
    Correct me if I am worng but most of us have single processor systems and, if we do a ctl-alt-del to see the Task Manager, we can always see several processes running at once on our machines.
    ScottGem's Avatar
    ScottGem Posts: 64,966, Reputation: 6056
    Computer Expert and Renaissance Man
     
    #3

    Apr 18, 2006, 08:21 AM
    A processor can only do one thing at a time. Multi-tasking is handled by rapidly switching between processes so it appears to be doing multiple things.
    cajalat's Avatar
    cajalat Posts: 469, Reputation: 66
    Full Member
     
    #4

    Apr 18, 2006, 09:05 AM
    That was true for a long time that only one process can be in the running state at any given time. Other processes that needed CPU cycles would be in the READY state and waiting for the Scheduled to give it attention as Scott correctly stated. However, with the advent of Hyper-Threading, and dual/multi-code CPU's you can indeed have multiple processes running at the same time. In Hyper-threading systems you can have two processes run at the same time. In Dual-Core systems you can have two processes run at the same time and if the dual-core system was also hyper-threading then you can have 4 processes run at the same time. And a process could potentially utilize two or more cores or Hyper-threads combination if the process was multi-threaded.

    Casey
    kp42484's Avatar
    kp42484 Posts: 39, Reputation: 16
    Junior Member
     
    #5

    Apr 18, 2006, 01:31 PM
    These are all good answers, and they clarified what I have learned about processes. BUT, the question is WHY? Why doesn't the operating system let processes run concurrently? Why does the CPU have to switch between processes instead of just letting them run all at once, creating havoc (what would happen if it did)?

    My textbook says: "Potentially, all these processes can execute concurrently, with the CPU multiplexed among them." Why potentially?

    Not bashing any answers, it's just that my original question was why does it work like that? And as for hyperthreading, we're not allowed to consider that yet ;)

    Thanks
    ScottGem's Avatar
    ScottGem Posts: 64,966, Reputation: 6056
    Computer Expert and Renaissance Man
     
    #6

    Apr 18, 2006, 03:54 PM
    It not a matter of letting, it's a matter of the limitations of the chip. Your textbook is discussing a technique (multiplexing) that is similar to Hyper threading and not available in chips until recently.
    cajalat's Avatar
    cajalat Posts: 469, Reputation: 66
    Full Member
     
    #7

    Apr 18, 2006, 04:57 PM
    Well in theory processes can run at the same time but the Operating System schedules so much CPU time/cycles per process. At a basic level, the CPU executes what's called Microcode instructions. These instructions can take less than 1 clock cycle to multiple clock cycles to execute depending on the CPU architecture and what the instruction does. But in a given second the CPU could run many micro instruction. The OS sits on top of that and sort of controls what process gets what attention. It (the OS) can schedule two processes to share some of the CPU cycles by giving a quantum of time for each process. So a process gets a fraction of a microsecond (quantum) to do what it pleases with the CPU and then the next quantum is given to the next process and so forth. This gives the effect of sharing the CPU but not exactly at the same time though it seems that way. Now suppose a program is multithreaded where portions of the program and go off running doing something in the background while the rest of the program does something else (e.g. saving a copy of a document in the background while letting you continue to edit a document). If you have two CPU's (or dual core, or HT), the program can fork a child process to run on another CPU which goes off and saves a copy of a document while the main process runs on the first CPU allowing you say to edit a document. This still one process per CPU. However, a CPU architecture can be such that a process that forks (a multi-threaded process) can use different portions of the same CPU at the same time.

    So to answer your question (I think/hope) the CPU doesn't really make the decision to let all process run at the same time, it is the OS that does that. And the OS needs to schedule not just the CPU cycles but also access to the memory and if each process tried to access the same memory space and use the CPU at the same time then we'd have a mess on our hands. The OS thus schedules each process to run.

    Is this sort of what you were getting at? Let us know and maybe we can home in better on your question.
    kp42484's Avatar
    kp42484 Posts: 39, Reputation: 16
    Junior Member
     
    #8

    Apr 19, 2006, 07:27 AM
    Cajalat, you said "And the OS needs to schedule not just the CPU cycles but also access to the memory and if each process tried to access the same memory space and use the CPU at the same time then we'd have a mess on our hands. The OS thus schedules each process to run."

    Thank you! Now it makes sense! So you're saying that the OS acts this way (I understood that, just not WHY) because the processes can't be allowed to access the same memory space at the same time? That is what I wanted to know--WHY does the OS do this, and what would happen if it just let all the processes be in the running state at the same time.

    Thank you too, ScottGem, for your insights--they helped me better understand what I learned in class!

    Thanks again
    jc105's Avatar
    jc105 Posts: 162, Reputation: 17
    Junior Member
     
    #9

    May 2, 2006, 07:24 AM
    Its very simple WHY...

    Imagine that the CPU is a calculator, how many addition problems can you do at a time? One...

    How many individual calculations you can do per second is way more important that concurrent. Dual core is literally TWO processors running individual transactions millions of times a second. Multiple processors act identical to dual core.

    You'll note the XBOX 360 has 3 cores in their RISC chip and the PS3 will be sporting an 8-f******* core RISC based chip. RISC is the architecture based on supercomputers, created by IBM formerly used in the Mac G5.

    So simple answer is that a processor can do one thing at a time, it just so happens that time can be .00000000000001 seconds to do mathematic calculations that humans would choke on.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Processes [ 2 Answers ]

When I check the processes. I can delete some of them for the one session but they are back on again. How do I get rid of lots of these processes for good. Without costing money for programs? Thank you in advance! I do not know if it matters but I am running xp pro. Joe


View more questions Search