Multitasking , Memory Management and Process Cleanup
Posted: Thu Apr 02, 2009 10:30 am
Hi everybody,
I have been working on my kernel for few weeks now.I have just completed my memory manager recently.I need to clarifie some issues ; here is what i have done in memory manager
top level - malloc()
middle level - memory_mapper()
bottom - physical_frame_allocate().
1)malloc () - simple bin approach.starts allocation from 0xC0000000.
2)memory_mapper() - asks os for memory and maps this memory to the end of Heap(stating from 0XC0000000).( I have set 1023rd entry of page directory to itself so that i can manipulate physical address once paging is enabled)
3)physical_frame_allocate() - simple bitmap approach.memory_mapper() asks this function to supply pages.
These are for kernel code. and are working fine.Is writing memory manager for application layer code any different from this .I have been thinking
1) exact same methods except user heap starts from say 2 gb mark and
2) level bit in frame is set to user level.
would this suffice ??
Question 2) I have read James tutorial for multitasking. Is there some other way for copying stack to different location.( Handling esp and ebp )
question 3) How does kernel knows if a process has ended if process do not call exit() explicitly.I have read that compilers places exit() call at end but what if system call is implemented by some different name?What does DJGPP add in such cases ?
I have been working on my kernel for few weeks now.I have just completed my memory manager recently.I need to clarifie some issues ; here is what i have done in memory manager
top level - malloc()
middle level - memory_mapper()
bottom - physical_frame_allocate().
1)malloc () - simple bin approach.starts allocation from 0xC0000000.
2)memory_mapper() - asks os for memory and maps this memory to the end of Heap(stating from 0XC0000000).( I have set 1023rd entry of page directory to itself so that i can manipulate physical address once paging is enabled)
3)physical_frame_allocate() - simple bitmap approach.memory_mapper() asks this function to supply pages.
These are for kernel code. and are working fine.Is writing memory manager for application layer code any different from this .I have been thinking
1) exact same methods except user heap starts from say 2 gb mark and
2) level bit in frame is set to user level.
would this suffice ??
Question 2) I have read James tutorial for multitasking. Is there some other way for copying stack to different location.( Handling esp and ebp )
question 3) How does kernel knows if a process has ended if process do not call exit() explicitly.I have read that compilers places exit() call at end but what if system call is implemented by some different name?What does DJGPP add in such cases ?