i add a c function as a thread which is executed along wit my shell...
after the function ends i get page fault..
but how to kill the thread as soon as function ends ??
is it possible by adding code in pagefault isr... to kill the thread.
doubt in mulitasking..
- piranha
- Member
- Posts: 1391
- Joined: Thu Dec 21, 2006 7:42 pm
- Location: Unknown. Momentum is pretty certain, however.
- Contact:
Re: doubt in mulitasking..
Simply remove that task from the list of tasks. It's a simple exit function, cleaning up and then killing itself.
If you are using a linked list, just remove it (Change the 'next' value in the task before it to the task after it) and clear the memory.
Or, if an array, clear the array (or set a flag to zombie or something) and have the scheduler skip it.
Edit: If a process creates a pagefault, I kill it anyway. Write your exit() function and call it from the fault handler.
-JL
If you are using a linked list, just remove it (Change the 'next' value in the task before it to the task after it) and clear the memory.
Or, if an array, clear the array (or set a flag to zombie or something) and have the scheduler skip it.
Edit: If a process creates a pagefault, I kill it anyway. Write your exit() function and call it from the fault handler.
-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
Re: doubt in mulitasking..
cool.. i too had the same thought.... and one more thing does any of the hobby os use cooperative multitasking ???
- piranha
- Member
- Posts: 1391
- Joined: Thu Dec 21, 2006 7:42 pm
- Location: Unknown. Momentum is pretty certain, however.
- Contact:
Re: doubt in mulitasking..
My old kernel did.
My new kernel uses IO wait flags and task states. I might add a system call that switches tasks, but there really is no need.
Cooperative can make things more difficult, application wise.
-JL
My new kernel uses IO wait flags and task states. I might add a system call that switches tasks, but there really is no need.
Cooperative can make things more difficult, application wise.
-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io