Ok - since my internet connection is not the most reliable one and I 've yet to do some work to get it running on my linux box, here comes the answer to your question - and for all the others, who are interested in it.
well - the *very* important snippet of adding a task to the system is already demonstrated in my multitasking-text.
What you need further is wrapping and bookkeeping around this one crucial function. I even add threads with this functions - just define entry point and owner and there you go.
Here are the steps one needs to take to add a process (aka fork):
1. In memory management, create context information: fetch a pagedirectory (with kernel land mapped into it for the sake of page fault), build up basic memory management information - about allocated chunks of virtual memory (more about this later) - and inform the file subsystem about the forked process to duplicate file descriptors and to enter the working and root directory into the process info structure.
2. memory management shall inform system about the created task: entry point and user stack top. System stores away the entry point and creates a task with entry 0xdeadbeef.
3. enqueue the new process for execution. Upon pagefault have the pager query memory management for the adress - 0xdeadbeef indicates a new process: replace that adress with the entry point of the process and add page table entries for the process image - then copy the process code and data. You can have both the heap and the stack handled via lazy paging: allocate a realm of virtual memory for them and let the pager to the rest.
As a final hint for development:
make pictures - I do it all the times in my head to imagine how things could work. Draw them if necessary. Write down what you want to do in whole sentences, as I've done above. You as the developer need to understand your endeavour at first - and then the computer.
second: wrap your brain around this Idea: You tell where a task starts, you tell where it gets its memory from, you tell ... know what I mean: you are the ultimate master of your computer.
hth &ccw
@Pype&Solar: shan't we put that into the faq?
@wacky - Multitasking question - adding tasks/processes
-
- Member
- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
@wacky - Multitasking question - adding tasks/processes
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image
Re:@wacky - Multitasking question - adding tasks/processes
Just go ahead. It's the basic idea of a Wiki that *anyone* could add *anything*. There aren't admins, there are just peers. (And I'm not Admin anyway, much as I'd like it to clean it up a bit... )
Every good solution is obvious once you've found it.