Changeset 416 for trunk/kernel/kern/process.h
- Timestamp:
- Jan 4, 2018, 10:05:47 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/process.h
r415 r416 267 267 268 268 /********************************************************************************************* 269 * This function allows any thread running in any cluster to block, unblock or delete 270 * all threads of a given process identified by the <process> argument, dependig on the 271 * <acion_type> argument. 272 * It can be called by the sys_kill() or sys_exit() functions to handle the "kill" & "exit" 273 * system calls, or by the process_make_exec() function to handle the "exec" system call. 274 * It must be executed in the owner cluster for the target process (using the relevant RPC 275 * (RPC_PROCESS_SIGNAL or RPC_PROCESS_EXEC) if the client thread in not running in the 276 * owner cluster. 277 * It uses the multicast, non blocking, RPC_PROCESS_KILL to send the signal to all process 278 * copies in parallel, block & deschedule when all signals have been sent, and finally 279 * returns only when all responses have been received and the operation is completed. 280 ********************************************************************************************* 281 * @ process : pointer on the process descriptor. 282 * @ action_type : BLOCK_ALL_THREADS / UNBLOCK_ALL_THREADS / DELETE_ALL_THREADS 269 * This function allows a client thread running in the owner cluster of a process identified 270 * by the <process> argument to block, unblock or delete all threads of the target process, 271 * depending on the <action_type> argument. The scenario is the following: 272 * - It uses the multicast, non blocking rpc_process_sigaction_client() function to send 273 * parallel requests to all remote clusters containing a process copy. Then it blocks 274 $ and deschedule to wait completion of these parrallel requests. 275 * - In each remote cluster, the rpc_process_sigaction_server() function, calls directly 276 * the relevant process_block(), process_unblock(), or process_delete() function, and 277 * decrement the responses counter to signal completion. The last server unblock 278 * the client thread. 279 * - Finally, the client thread calls directly the process_block(), process_unblock(), or 280 * process_delete() function in the owner cluster. 281 * It is used by the sys_kill() & sys_exit() functions to handle the "kill" & "exit" syscalls. 282 * It is also used by the process_make_exec() function to handle the "exec" syscall. 283 * WARNING : the DELETE and the BLOCK actions are NOT executed on the client thread. 284 ********************************************************************************************* 285 * @ process : pointer on the process descriptor in owner cluster. 286 * @ action_type : BLOCK_ALL_THREADS / UNBLOCK_ALL_THREADS / DELETE_ALL_THREADS 283 287 ********************************************************************************************/ 284 288 void process_sigaction( process_t * process, … … 287 291 /********************************************************************************************* 288 292 * This function blocks all threads of a given user process in a given cluster. 289 * It is always called by a local RPC thread, through the multicast RPC_PROCESS_KILL. 290 * It loop on all local threads of the process, requesting the relevant schedulers to 291 * block and deschedule these threads, using IPI if required. The threads are not detached 292 * from the scheduler, and not detached from the local process. 293 * It acknowledges the client thread in the owner cluster only when all process threads 294 * are descheduled and blocked on the BLOCKED_GLOBAL condition, using the <rsp_xp> argument. 293 * It loops on all local threads of the process, set the THREAD_BLOCKED_GLOBAL bit, 294 * and request the relevant schedulers to acknowledge the blocking, using IPI if required. 295 * The threads are not detached from the scheduler, and not detached from the local process. 296 * This function returns only when all blockable threads in cluster are actually blocked. 297 * WARNING : the client thread defined by the <client_xp> argument is NOT blocked. 295 298 ********************************************************************************************* 296 299 * @ process : pointer on the target process descriptor. 297 * @ rsp_xp : extended pointer on the response counter. 298 * # client_xp : extended pointer on client thread descriptor. 300 * @ client_xp : extended pointer on the client thread, that should not be blocked. 299 301 ********************************************************************************************/ 300 302 void process_block( process_t * process, 301 xptr_t rsp_xp,302 303 xptr_t client_xp ); 303 304 304 305 /********************************************************************************************* 305 306 * This function unblocks all threads of a given user process in a given cluster. 306 * It is always called by a local RPC thread, through the multicast RPC_PROCESS_KILL.307 * It loops on local threads of the process, to reset the BLOCKED_GLOBAL bit in all threads.308 * It acknowledges directly the client thread in the owner cluster when this is done,309 * using the <rsp_xp> argument.310 307 ********************************************************************************************* 311 308 * @ process : pointer on the process descriptor. 312 * @ rsp_xp : extended pointer on the response counter. 313 * # client_xp : extended pointer on client thread descriptor. 314 ********************************************************************************************/ 315 void process_unblock( process_t * process, 316 xptr_t rsp_xp, 317 xptr_t client_xp ); 318 319 /********************************************************************************************* 320 * This function delete all threads descriptors, of given user process in a given cluster. 321 * It is always called by a local RPC thread, through the multicast RPC_PROCESS_KILL. 322 * It detach all process threads from the scheduler, detach the threads from the local 323 * process, and release the local memory allocated to threads descriptors (including the 324 * associated structures such as CPU and FPU context). Finally, it release the memory 325 * allocated to the local process descriptor itself, but only when the local cluster 326 * is NOT the process owner, but only a copy. It acknowledges directly the client thread 327 * in the owner cluster, using ithe <rsp_xp> argument. 309 ********************************************************************************************/ 310 void process_unblock( process_t * process ); 311 312 /********************************************************************************************* 313 * This function delete all threads, of a given user process in a given cluster. 314 * It loops on all local threads of the process, and set the THREAD_FLAG_REQ_DELETE bit. 315 * For each marked thread, the following actions will be done by the scheduler at the next 316 * scheduling point: 317 * - the thread will be detached from the scheduler. 318 * - the thread will be detached from the local process descriptor. 319 * - the thread will be detached from parent if required. 320 * - the memory allocated to the thread descriptor is released. 321 * - the memory allocated to the process descriptor is released, if it is the last thread. 322 * WARNING : the client thread defined by the <client_xp> argument is NOT deleted. 328 323 ********************************************************************************************* 329 324 * @ process : pointer on the process descriptor. 330 * @ rsp_xp : extended pointer on the response counter. 331 * # client_xp : extended pointer on client thread descriptor. 325 * @ client_xp : extended pointer on the client thread, that should not be deleted. 332 326 ********************************************************************************************/ 333 327 void process_delete( process_t * process, 334 xptr_t rsp_xp,335 328 xptr_t client_xp ); 336 329 … … 392 385 * It must be executed by a thread running in the calling process owner cluster. 393 386 * It uses twice the multicast RPC_PROCESS_SIGNAL to first block all process threads 394 * in all clusters, and then delete all thread 395 ********************************************************************************************* 396 * @ p rocess : pointer on process descriptor in owner cluster.387 * in all clusters, and then delete all threads and process descriptors. 388 ********************************************************************************************* 389 * @ pid : process identifier. 397 390 * @ status : exit return value. 398 391 ********************************************************************************************/ 399 void process_make_exit( p rocess_t * process,392 void process_make_exit( pid_t pid, 400 393 uint32_t status ); 401 394 … … 408 401 * all process threads in all clusters, and then delete process descriptors. 409 402 ********************************************************************************************* 410 * @ p rocess : pointer on process descriptor in owner cluster.411 * @ sig_id 412 ********************************************************************************************/ 413 void process_make_kill( p rocess_t * process,414 uint32_t 403 * @ pid : process identifier. 404 * @ sig_id : signal type. 405 ********************************************************************************************/ 406 void process_make_kill( pid_t pid, 407 uint32_t sig_id ); 415 408 416 409
Note: See TracChangeset
for help on using the changeset viewer.