Page 1 of 1
Enabling tasks
Posted: Sat Jul 21, 2007 1:04 pm
by artrecks
I want to enable tasks in my OS, but I still only have a physical memory manager, I want to know if is better to use paging ( or if paging is the unique way of getting tasks enabled ).
Thx
Bye
Posted: Sat Jul 21, 2007 1:39 pm
by Assembler
Consider the wiki
http://www.osdev.org/wiki/Context_Switching
http://www.osdev.org/wiki/Memory_Management
Paging is a must if you want to support virtual memory, in my opinion its a must.
Posted: Sat Jul 21, 2007 3:34 pm
by Kevin McGuire
You could play around with tasks before actually complicating it with paging. I remember when I tinkering with threading in a single address space.
It actually might be
better to try and implement threading first. The reason is you can have a achievable goal to reach.
- write a simple scheduler that uses the timer to switch between threads in a single address space.
- verify that it works, feel good about your self, and show someone.
- delete all the code for the scheduler, and all the calls for creating threads.
- go to bed, wait until the afternoon of the next day.
- try working with paging, get something crude working.
- write the scheduler all over again with out looking at the old code (because you deleted it), but this time try to use address spaces.
Posted: Thu Jul 26, 2007 12:28 pm
by salil_bhagurkar
You do not need paging and allied complicated stuff initially for multitasking in your os. You need to write a simple scheduler initially which will round robin all the registered tasks.
The scheduler loads all the tasks by using their stored context structures. As for complicating all that stuff you add the address spaces to the context structures.
Each task gets a new map of pages which prevents it to access other process memory structures/code.
Getting a new address space for each process is fairly simple. All you have to do is load the base address of a new page directory-table-frame structure everytime you switch to a new task.
As for starting from the basics you could initially round robin between two small assembly tasks that don't use much of the registers... Then thats where you start complicating your code by adding functions to save more registers and stuff. Then you add functions for maintaining a linked list of all the tasks (assuming that you have a memory manager) and on...