diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-07-04 19:25:12 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-07-04 19:25:12 +0300 |
| commit | 07c2376702fb3d508d6ffad6b0ce93b83972ad6e (patch) | |
| tree | 9ce46b000f8411fa86118645063b4df05d018dbf /arch | |
| parent | 66e7f184a925247bac51aae02d01483faa5454fc (diff) | |
| download | kmi-07c2376702fb3d508d6ffad6b0ce93b83972ad6e.tar.gz kmi-07c2376702fb3d508d6ffad6b0ce93b83972ad6e.zip | |
add zombie and orphan threads
+ Should write this down somewhere but the idea is that when a process
gets killed, it frees all the memory it can, making all threads within
that process orphans. Orphaned threads are assigned to the init
process, which will generally call exit() on each one. Zombie threads
are threads that own some bit of shared data, and whose reference
count is above zero. They may not be swapped to or called, even though
they take up space in thread map and reserve their thread ID.
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/riscv64/kernel/vmem.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/riscv64/kernel/vmem.c b/arch/riscv64/kernel/vmem.c index d00a6c9..f87c76d 100644 --- a/arch/riscv64/kernel/vmem.c +++ b/arch/riscv64/kernel/vmem.c @@ -512,6 +512,17 @@ void setup_rpc_stack(struct tcb *t) t->arch.rpc_idx = 511; } +void destroy_rpc_stack(struct tcb *t) +{ + size_t pages = order_size(MM_O1) / BASE_PAGE_SIZE; + for (size_t i = 0; i < pages; ++i) { + pm_t page; enum mm_order order; + stat_vpage(t->rpc.vmem, RPC_STACK_BASE + BASE_PAGE_SIZE * i, + &page, &order, NULL); + free_page(page, order); + } +} + vm_t rpc_position(struct tcb *t) { /** @todo we assume rpc_idx is updated on every segfault of the rpc stack */ |
