killing tasks

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Post by piranha »

Does mine require an interrupt? I'm just calling switch tasks....

-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
User avatar
lukem95
Member
Member
Posts: 536
Joined: Fri Aug 03, 2007 6:03 am
Location: Cambridge, UK

Post by lukem95 »

i think it was meant that it would require an interrupt if being called from an external application, and therefore using a syscall.
~ Lukem95 [ Cake ]
Release: 0.08b
Image
Ready4Dis
Member
Member
Posts: 571
Joined: Sat Nov 18, 2006 9:11 am

Post by Ready4Dis »

I delete tasks in my idle function, and just skip/bypass them in my task manager (I am probably going to start using a seperate kill list, just incase the system is really busy and doesn't delete them fast). This means, I am not wasting many cylces or extra switches to kill tasks, it is marked for deletion, then when my idle function is called, it will check if there is anything ready for deletion, it only deletes one task at a time and then relinquishes it's time, so it will never try to take much time away from the OS if it's busy, and since my idle loop is in kernel mode, there is no extra context switch. Works good for me thus far, and when it's really busy the tasks will just sit and wait to be removed until the system has some time (although, my idle function gets called for at ~1ms every once in a while, so they will slowly dissappear even if busy, but it will never turn interrupts off for long, or take much CPU away from more important things).
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post by pcmattman »

My kill function sets the process status to "DEAD". DEAD processes are removed after each "round" in my round-robin scheduler.

The kill function also cleans up the address space - freeing all non-kernel pages and the page directory itself. This way I don't need to have any special code to unload binaries, which saves time ;). It probably isn't the best place, but it works.
Post Reply