اطلاعیه

بستن
No announcement yet.

Linux Process management

بستن
این موضوع بسته شده است.
X
X
 
  • فیلتر کردن
  • زمان
  • نمایش
Clear All
پست های جدید

  • Linux Process management

    Process control and the ability for inter process communication is handled by the Linux kernel.
    Tools for working with processes

    • accton - Turns process accounting on and off. Uses the file /var/log/pacct. To turn it on type "accton /var/log/pacct". Use the command with no arguments to turn it off.
    • kill - Kill a process by number
    • killall - Send a signal to a process by name
    • lastcomm (1) - Display information about previous commands in reverse order. Works only if process accounting is on.
    • nice - Set process priority of new processes.
    • ps(1) - Used to report the status of one or more processes.
    • pstree(1) - Display the tree of running processes.
    • renice(8) - Can be used to change the process priority of a currently running process.
    • sa(8) - Generates a summary of information about users' processes that are stored in the /var/log/pacct file.
    • skill - Report process status.
    • snice - Report process status.
    • top - Displays the processes that are using the most CPU resources.
    Process Scheduling

    Computer time on Linux systems is allocated in jiffies. A jiffie is a microprocessor time slice. On most Linux systems it is 1/100 of a second. On some systems it is 1/1024 of a second. The Linux kernel controls process scheduling. There are three types of scheduling:
    1. normal - Referred to as other, this is the scheduling type set for normal programs
    2. FIFO - This is a real time scheduling priority. The FIFO term means the first process started (first in) will be the first done (first out). The only time this type of process exits is if it sleeps, is rescheduled, or if it must wait on other kernel priorities to be done.
    3. RR - This is a round robin type of scheduling, where each task gets a certain amount of time then it must exit, yield control to the next task and get back into the task queue. This is a real time scheduling priority.

    Linux processes have the following characteristics:
    1. policy - normal or real time. Real time processes have a higher priority than normal processes.
    2. priority - The process priority. It is a number between -20 and 19. The value of -20 is the highest, and 19 is the lowest priority. Process priority can be set with the nice(1) command and changed using the renice(8) command.

    Inter-Process Communication

    The types of inter process communication are:
    1. Signals - Sent by other processes or the kernel to a specific process to indicate various conditions.
    2. Pipes - Unnamed pipes set up by the shell normally with the "|" character to route output from one program to the input of another.
    3. FIFOS - Named pipes operating on the basis of first data in, first data out.
    4. Message queues - Message queues are a mechanism set up to allow one or more processes to write messages that can be read by one or more other processes.
    5. Semaphores - Counters that are used to control access to shared resources. These counters are used as a locking mechanism to prevent more than one process from using the resource at a time.
    6. Shared memory - The mapping of a memory area to be shared by multiple processes.

    Message queues, semaphores, and shared memory can be accessed by the processes if they have access permission to the resource as set up by the object's creator. The process must pass an identifier to the kernel to be able to get the access.
    Signals

    Linux Signals are:
    Signal Name Number Description
    SIGHUP 1 Hangup (POSIX)
    SIGINT 2 Terminal interrupt (ANSI)
    SIGQUIT 3 Terminal quit (POSIX)
    SIGILL 4 Illegal instruction (ANSI)
    SIGTRAP 5 Trace trap (POSIX)
    SIGIOT 6 IOT Trap (4.2 BSD)
    SIGBUS 7 BUS error (4.2 BSD)
    SIGFPE 8 Floating point exception (ANSI)
    SIGKILL 9 Kill(can't be caught or ignored) (POSIX)
    SIGUSR1 10 User defined signal 1 (POSIX)
    SIGSEGV 11 Invalid memory segment access (ANSI)
    SIGUSR2 12 User defined signal 2 (POSIX)
    SIGPIPE 13 Write on a pipe with no reader, Broken pipe (POSIX)
    SIGALRM 14 Alarm clock (POSIX)
    SIGTERM 15 Termination (ANSI)
    SIGSTKFLT 16 Stack fault
    SIGCHLD 17 Child process has stopped or exited, changed (POSIX)
    SIGCONT 18 Continue executing, if stopped (POSIX)
    SIGSTOP 19 Stop executing(can't be caught or ignored) (POSIX)
    SIGTSTP 20 Terminal stop signal (POSIX)
    SIGTTIN 21 Background process trying to read, from TTY (POSIX)
    SIGTTOU 22 Background process trying to write, to TTY (POSIX)
    SIGURG 23 Urgent condition on socket (4.2 BSD)
    SIGXCPU 24 CPU limit exceeded (4.2 BSD)
    SIGXFSZ 25 File size limit exceeded (4.2 BSD)
    SIGVTALRM 26 Virtual alarm clock (4.2 BSD)
    SIGPROF 27 Profiling alarm clock (4.2 BSD)
    SIGWINCH 28 Window size change (4.3 BSD, Sun)
    SIGIO 29 I/O now possible (4.2 BSD)
    SIGPWR 30 Power failure restart (System V)
    As noted above, processes can ignore, block, or catch all signals except SIGSTOP and SIGKILL. If a process catches a signal, it means that it includes code that will take appropriate action when the signal is received. If the signal is not caught by the process, the kernel will take default action for the signal.
    FIFOs

    FIFOs are permanent objects and can be created using the mkfifo(1) or mknod(1) command. Inside the program, the FIFO can be created using the mknod command, then opened and read from or written to just like a normal file. The FIFO is normally in blocking mode when attempting to perform read operations.

    http://comptechdoc.org/os/linux/howl...hlprocess.html

در حال انجام ...
X