Linux training in Chandigarh, defined task structure, concepts of task structure, if you are interested in linux training visit CBitss Technologies: SCO 23-24-25 Sector 34 A Chandigarh
2. The concept of a process is the foundation of any multiprogramming
operating system.A technique is usually defined as an example of a program in
execution; Therefore, if 16 users run vi at the same time, there are 16
different processes (although they can share the same executable code).
Each process has some unique information, which is stored in the process
descriptor of the task_struct type, which is the object of the task_struct.
Struct task _struct
3. {
volatile long state;
long counter;
long priority;
unsigned long signal;
unsigned long blocked;
unsigned long flags;
int errno;
int debugreg[8];
struct task_struct *next_task;
struct task_struct *prev_task;
struct mm_struct mm;
int pid, uid,gid;
struct fs_struct fs;
long utime, stime, cutime, cstime, start_time;
}
4. The state field of task_struct describes the process that is currently occurring.
The following are possible process states:
TASK_RUNNING :
The process is either executed on the CPU or waiting for execution.
TASK_INTERRUPTIBLE : The process pauses (sleeps) until certain conditions are
met. Initiating a hardware interrupt,acquit the system resource that is waiting
for the process or sending the signal is an example of a situation that can
wake up the process, restoring its state to TASK_RUNNING.
5. TASK_UNINTERRUPTIBLE: In this state, the process does not interrupt any hardware interrupts or
any signals.
TASK_STOPPED:
Process execution stopped: after receiving SIGSTOP, SIGTSTP, SIGTTIN, or SIGTTOU signal, the
process enters this state
TASK_ZOMBIE : Process execution has discontinue, but the parent process has not stopped.The
kernel can not abandon the data contained in the dead process task_struct because the original
process may require it.
The counter variable saves the time in Tick, which can still be run until a mandatory scheduling
operation is performed. The scheduler uses the counter value to select the next process.
6. Priority keeps the priority of the process.
Signal variable contains a bit mask for the signal received by the process.
Bolcked contains a bit mask for all signals that the process plans to process later.
Flags contain system status flags.
errono contains the error code if generated.
debugreg[8] assigns the debugger to that err code.
*next_task and *prev_
Work All processes are recorded in the double-linked list with the help of these two components.
mm_struct mm gather data for each process needed for memory management, mm_struct stores
this data.
Each process has its own process ID number, pid, user ID, uid, goup ID, gid.
File system-specific data is stored in fs_struct fs.
The utime and stime variables retain the time spent by the process in user mode and system mode.
cutime and cstime contain the sum of the corresponding times of all child processes, and start_time
contains the time to generate the current process.