[moved here]a Random Idea on Multitasking...
Posted: Sat Feb 17, 2007 11:33 am
[moved here]It seems that this topic should be here...
Hi all.
These days I've just thought up something random about multitasking while I'm just imeplementing the traditional one.
Let's say that we have procedure A,B,C... and main(They are in different programs and loaded into different processes at runtime) and when developing the programs we don't know how many procedure like A,B and C will be created(they're all different). At runtime main calls A,B and C... quite frequently(at a fixed and very high frequency or even execute one call immediately after another) and A,B and C... should be called at the same time(in a logical perspect) if they're called(i.e. they're a combination but we can't determine them when compiling because maybe some more may join them). Each time they're called together they form something like a frame,just like the refresh of your screen.It's like a frame because they are together and produced frequently.
For example(just an example,I'm not professional in this and don't want to discuss details about this) in a 3D engine when a object is pushed its position will be influenced.Then immediately the position change will influence its lighting and the lighting shall be recalculated(updated) at once.They may depend on one another and even each other(for example F=Bvq).
So the each process among A,B and C etc is just like one subsystem in the 3D engine.The engine give every stage many objects and a common time line.The time line makes events happening at different times synchronised respectively.When other facters are added to the engine(as new processes at loadtime) they can work well with the existing parts of the engine as long as they obey the data structure for each object and the TIME LINE.
We may have other occasions like that:we have several processes in memory all the time to provide frequent services,synchronised with each other. For this reason I want to add a multitasking functionality to my OS.Such as:
INT 0X70 --------process frame(the frame mentioned above) functionality
EAX = 0 ---- create a new frame
EBX = new frame id num.
ECX = time alignment
--------
EAX = 1 ---- add the current process to a frame
--------
EAX = 2 ---- quit from a registered frame
EBX = frame id num.
--------
(activate a frame,stop a frame,discard a frame,etc)......
A frame is a set of process expected to synchronise with each other to form this frame.One frame will be produced only if every member(process) within it executes once.And then comes the next frame,etc.If time alignment is 0,then the frame will be one after another.If not,after one frame is produced,the next won't begin to be produced until the time inteval reaches 0.We can then add a process to a frame to join their synchronisation(in my original idea it will start with the rest at the next new frame after joining).As long as the new process knows the frame id num.,it can join it.(Every process's default frame is itself.But I haven't thought about how to present it.)
And we can have several frames in memory running in thier own time line.We can even join 2 frames together to let them share 1 time line.With the help of time line,it would be a little easier to understand and control the execution trace.We can even use that to locate processes.
Maybe I don't express the idea clearly.But comments according to your understanding are welcomed.Thanks.![Smile :)](./images/smilies/icon_smile.gif)
[edit]Even if you don't want to execute the processes so frequently,the time line can also bring convenience(I'm not quite shure about this).
Hi all.
These days I've just thought up something random about multitasking while I'm just imeplementing the traditional one.
Let's say that we have procedure A,B,C... and main(They are in different programs and loaded into different processes at runtime) and when developing the programs we don't know how many procedure like A,B and C will be created(they're all different). At runtime main calls A,B and C... quite frequently(at a fixed and very high frequency or even execute one call immediately after another) and A,B and C... should be called at the same time(in a logical perspect) if they're called(i.e. they're a combination but we can't determine them when compiling because maybe some more may join them). Each time they're called together they form something like a frame,just like the refresh of your screen.It's like a frame because they are together and produced frequently.
For example(just an example,I'm not professional in this and don't want to discuss details about this) in a 3D engine when a object is pushed its position will be influenced.Then immediately the position change will influence its lighting and the lighting shall be recalculated(updated) at once.They may depend on one another and even each other(for example F=Bvq).
So the each process among A,B and C etc is just like one subsystem in the 3D engine.The engine give every stage many objects and a common time line.The time line makes events happening at different times synchronised respectively.When other facters are added to the engine(as new processes at loadtime) they can work well with the existing parts of the engine as long as they obey the data structure for each object and the TIME LINE.
We may have other occasions like that:we have several processes in memory all the time to provide frequent services,synchronised with each other. For this reason I want to add a multitasking functionality to my OS.Such as:
INT 0X70 --------process frame(the frame mentioned above) functionality
EAX = 0 ---- create a new frame
EBX = new frame id num.
ECX = time alignment
--------
EAX = 1 ---- add the current process to a frame
--------
EAX = 2 ---- quit from a registered frame
EBX = frame id num.
--------
(activate a frame,stop a frame,discard a frame,etc)......
A frame is a set of process expected to synchronise with each other to form this frame.One frame will be produced only if every member(process) within it executes once.And then comes the next frame,etc.If time alignment is 0,then the frame will be one after another.If not,after one frame is produced,the next won't begin to be produced until the time inteval reaches 0.We can then add a process to a frame to join their synchronisation(in my original idea it will start with the rest at the next new frame after joining).As long as the new process knows the frame id num.,it can join it.(Every process's default frame is itself.But I haven't thought about how to present it.)
And we can have several frames in memory running in thier own time line.We can even join 2 frames together to let them share 1 time line.With the help of time line,it would be a little easier to understand and control the execution trace.We can even use that to locate processes.
Maybe I don't express the idea clearly.But comments according to your understanding are welcomed.Thanks.
![Smile :)](./images/smilies/icon_smile.gif)
[edit]Even if you don't want to execute the processes so frequently,the time line can also bring convenience(I'm not quite shure about this).