Skip to main content

Posts

Showing posts from December 16, 2003
Fork Syscall 1. There is a function fork.c::nr_processes() which gets the number of processes. Note that processes corresponding to a CPU are included only when the CPU is online. It gets these values using the per_cpu() macro which gets the values used by CPU. 2. These are the 2 macros defined for allocating and freeing a task struct # define alloc_task_struct() kmem_cache_alloc(task_struct_cachep, GFP_KERNEL) # define free_task_struct(tsk) \ kmem_cache_free(task_struct_cachep, (tsk)) 3. Wait Queue Functions The folowing functions deal with wait queues of processes add_wait_queue add_wait_queue_exclusive remove_wait_queue prepare_to_wait prepare_to_wait_exclusive finish_wait autoremove_wake_function All the functions dealing with wait_queues are simple wrapper on functions given in < linux/wait.h > . Generally they change the wait queue flag and then do a spin_lock before the call and a spin_unlock() after the call. Pls see the