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
Enabling tasks
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.
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.
Systems and Computer Engineering Researcher
"Do you pine for the nice days of Minix-1.1, when men were men and wrote their own device drivers?" -- Linus Torvalds
http://sce.carleton.ca/~maslan
"Do you pine for the nice days of Minix-1.1, when men were men and wrote their own device drivers?" -- Linus Torvalds
http://sce.carleton.ca/~maslan
- Kevin McGuire
- Member
- Posts: 843
- Joined: Tue Nov 09, 2004 12:00 am
- Location: United States
- Contact:
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.
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.
- salil_bhagurkar
- Member
- Posts: 261
- Joined: Mon Feb 19, 2007 10:40 am
- Location: India
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...
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...