Linux 202 Training Module Program and Process
This presentation will cover the following topics Thread top ps details mem, cpu, etc
Thread A thread of execution is often regarded as the smallest unit of processing that a scheduler works on. Following are some of the major differences between the thread and the processes : Processes do not share their address space while threads executing under same process share the address space. Context switching between threads is fast as compared to context switching between processes
#include <pthread.h> int pthread_create(pthread_t *restrict tidp, const pthread_attr_t *restrict attr, void *(*start_rtn)(void), void *restrict arg)
Top command The top program provides a dynamic real-time view of a running system. It can display system summary information as well as a list of tasks currently being managed by the Linux kernel. top top - 10:28:24 up 4 days, 22:13, 4 users, load average: 0.00, 0.01, 0.05 Tasks: 219 total, 1 running, 217 sleeping, 0 stopped, 1 zombie Cpu(s): 0.2%us, 0.2%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 4046188k total, 3914008k used, 132180k free, 1028328k buffers Swap: 6127612k total, 263468k used, 5864144k free, 1422996k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 2494 netstorm 20 0 2180m 1096 1096 S 0.3 0.0 1:09.97 java 2588 root 20 0 2245m 23m 1312 S 0.3 0.6 2:07.85 java 2867 root 20 0 2570m 26m 1272 S 0.3 0.7 2:05.50 java 1 root 20 0 19416 688 456 S 0.0 0.0 0:00.87 init