Posts: 3,616
Threads: 287
Joined: Jan 2003
Say you write a utility in assembly, which, (like almost every assembly program) uses the EAX register. Fine. But what I don't understand is, surely Windows uses the EAX register as well, to display the GUI, and to do background operations. But what if you need the register, Windows needs the register, and some other processes/programs running in the background need the EAX register? Or any register! I might do:
And Windows might have put 0Fh there for another purpose, earlier. But I overwrote that! Surely that would mess it up...
So how does that work?
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Posts: 864
Threads: 13
Joined: Oct 2003
uhh....hence multitasking
igitalblackie.com - Done!
Ask about our hosting
-Goddess of the of the No More Religion Threads movement
Posts: 3,616
Threads: 287
Joined: Jan 2003
What? Virtual registers?
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Posts: 6,419
Threads: 74
Joined: Mar 2002
Nope.
Multitasking doesn't mean doing several things at the same time, but sharing processor time.
You just have your processor, so if you have to do 10 tasks you just divide the time assigning a small amout of time to each task. The system is complex, with priorities, interruptions and many things (in my career it is the most difficult subject
). But think about it as that you have a queue with all the tasks waiting to use the CPU. The first enters, works with the CPU during a small amount of time, then exits. Now the second one enters while the first one goes to the end of the queue.
Posts: 3,616
Threads: 287
Joined: Jan 2003
Gotcha. So that's all managed by the CPU? Or by the OS?
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Posts: 864
Threads: 13
Joined: Oct 2003
The OS does the controlling, the cpu just sits there and takes instructions.
igitalblackie.com - Done!
Ask about our hosting
-Goddess of the of the No More Religion Threads movement
Posts: 3,616
Threads: 287
Joined: Jan 2003
:o I think I can now fully appreciate just how brilliant the Windows/Linux people are.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Posts: 691
Threads: 5
Joined: Apr 2002
Each running process has a context, which stores information such as the registers, memory map and process id. The operating system is responsible for scheduling processes, when a process is scheduled out the OS saves its context somewhere in memory, the context is then restored when the process is rescheduled.
Register values often need to be saved when doing function calls within a single process also. Function calls often cause several register values to be pushed onto the stack, the called function can now overwrite and use those registers because the old values can be popped from the stack when the function returns.
esus saves.... Passes to Moses, shoots, he scores!
Posts: 3,616
Threads: 287
Joined: Jan 2003
And what exactly are processes? *Presses CTRL+ALT+DEL on a Win/XP machine* IEXPLORE.EXE is a process? :o
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Posts: 6,419
Threads: 74
Joined: Mar 2002
Well, a process is everything it's running. The OS Kernel, the graphics... Every program, your favourite game...