The Linux kernel stores the list of processes in a circular doubly linked list of structures task_struct, called the task list. The process descriptor (task_struct) contains all the information about a specific process.Each task_struct structure has a state enry which describes the current state of the process. At any time on a Linux machine the processes running on it are in exactly one of five different states. The struct task_struct and the five states are defined in linux/sched.h.
TASK_RUNNING - runnable; The task is either running or ready to run and waiting in the runqueue.
TASK_INTERRUPTIBLE - sleeping or blocked; In this state the process is waiting for some event to complete. When it completes, the kernel puts back the process to the runqueue and make it runnable by changing the state to TASK_RUNNING. The process can also respond to a signal in this state.
TASK_UNINTERRUPTIBLE - Uninterrupted sleep; This is exactly the same state as TASK_INTERRUPTIBLE but it cannot be interrupted by any signals to make it runnable. This happens typically with the IO operation. This is used when the process must wait without interruption or when the event is expected to occur quite quickly like an IO operation. They are unkillable as the task will not respond to signals(SIGKILL wont work). These are the D state process that you will find with the ps command. Its not advised to attempt a kill on this process (by killing the parent), as the task may be in the middle of some important operation and may be holding some resources.
TASK_ZOMBIE - Zombie; A special case when the task has completed but its parent has not yet reaped it, by issuing a wait4() system call. A zombie process just occupies an entry in the process table. This entry exists because in case the parent wants to access it, the descriptor should be available. When the parent calls wait4() a zombie disappears.
TASK_STOPPED - All is well :) and is stopped; The task is not running and will not be scheduled.May be killed or caught by other signals.
Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts
Thursday, February 11, 2010
Saturday, November 21, 2009
I'm There with FC12 (Fedora Core 12) and IBM desktop apps :)
Well it was a journey of a Linux freak . I lost the data in my entire TP. Thank heavens, I had my backup done in my USB HDD.
It all started up with FC12 The installation went fine, I didn't take a chance with putting ext4 file system on /boot partition as it was not working on FC11. The installation went fine and I got the IBM layer installed on it. Thanks to Grant Williamson for making appropriate packages available in the IBM yum repo. He was too good with his support. I was happy except that the mouse pointer was slow after the installation of the IBM layer. I tuned it through the Gnome preferences. Thanks Srini for the autoten repo to make the nonfree stuff working . Everything was set up and I was ready to click the Lotus notes icon. To my surprise nothing really happened. I tried the command line notes85.sh and it failed telling that the libnotes.so is not able to create a stack.
Phew!! the entire work has gone on a toss. I checked the logs and it showed that the Selinux is giving some permission errors. I turned the Selinux policy to permissive and then restarted notes. It worked like a charm!! :).
Now came the next issue. The Clearcase client which was running fine on FC11 has started giving me some errors. It started telling me that the libswt-mozilla-gtk-3236.so has some undefined symbol _ZN4nsID5ParseEPKc. Hmm.. I know what it means :-P. I got the xulrunner-devel package installed and made clearcase happy.
I haven't tried KDE yet. I want to keep up suspense and excitement, and gift me a surprise.
Here are my favourite apps, Being a hardcore KDE fan some of the apps below may not work well with Gnome.
Chat/IM - empathy/pidgin/sametime
IRC - Konversation
Password management - Kwallet
Personal Finance - kmymoney
Email - Lotus Notes / thunderbird
Twitter Microblogging - choqok
Notes - Tomboy/Kjots
Editor - vim/gedit/kate
Browser - Firefox/chrome/seamonkey
Music - amarok/rhythmbox
Other tools- rsibreak,digikam,gimp,picasa
IDE - Rational Application Developer/Eclipse
It all started up with FC12 The installation went fine, I didn't take a chance with putting ext4 file system on /boot partition as it was not working on FC11. The installation went fine and I got the IBM layer installed on it. Thanks to Grant Williamson for making appropriate packages available in the IBM yum repo. He was too good with his support. I was happy except that the mouse pointer was slow after the installation of the IBM layer. I tuned it through the Gnome preferences. Thanks Srini for the autoten repo to make the nonfree stuff working . Everything was set up and I was ready to click the Lotus notes icon. To my surprise nothing really happened. I tried the command line notes85.sh and it failed telling that the libnotes.so is not able to create a stack.
Phew!! the entire work has gone on a toss. I checked the logs and it showed that the Selinux is giving some permission errors. I turned the Selinux policy to permissive and then restarted notes. It worked like a charm!! :).
Now came the next issue. The Clearcase client which was running fine on FC11 has started giving me some errors. It started telling me that the libswt-mozilla-gtk-3236.so has some undefined symbol _ZN4nsID5ParseEPKc. Hmm.. I know what it means :-P. I got the xulrunner-devel package installed and made clearcase happy.
I haven't tried KDE yet. I want to keep up suspense and excitement, and gift me a surprise.
Here are my favourite apps, Being a hardcore KDE fan some of the apps below may not work well with Gnome.
Chat/IM - empathy/pidgin/sametime
IRC - Konversation
Password management - Kwallet
Personal Finance - kmymoney
Email - Lotus Notes / thunderbird
Twitter Microblogging - choqok
Notes - Tomboy/Kjots
Editor - vim/gedit/kate
Browser - Firefox/chrome/seamonkey
Music - amarok/rhythmbox
Other tools- rsibreak,digikam,gimp,picasa
IDE - Rational Application Developer/Eclipse
Using DVD as your Yum repo - FC12
Its as simple as this
vi /etc/yum.repos.d/dvd.repo
Put the following entries
[dvd]
name=Fedora DVD
baseurl=file:///media/Fedora\ 12\ i386\ DVD/
enabled=1
gpgcheck=0
Save and start using it :).
If you have a DVD image, them loop mount it to some location and modify the dvd.repo file as below
To Loop mount
mount -o loop /path/of/DVD.iso_file /path/to/your/mount_point
dvd.repo file
[dvd]
name=Fedora DVD
baseurl=file:///path/to/your/mountpoint
enabled=1
gpgcheck=0
vi /etc/yum.repos.d/dvd.repo
Put the following entries
[dvd]
name=Fedora DVD
baseurl=file:///media/Fedora\ 12\ i386\ DVD/
enabled=1
gpgcheck=0
Save
If you have a DVD image, them loop mount it to some location and modify the dvd.repo file as below
To Loop mount
mount -o loop /path/of/DVD.iso_file /path/to/your/mount_point
dvd.repo file
[dvd]
name=Fedora DVD
baseurl=file:///path/to/your/mountpoint
enabled=1
gpgcheck=0
Saturday, July 19, 2008
Special character ; at bashprompt
; is used as a command separator and to terminate a case statement at bash
#!/bin/bash
# This script is to explain the usage of the ; as a special character in bash.
# Sijo George
#--------------------------START-------------------------------
echo "Hello world,"; echo "How are you?"; # Execute two commands in a line using a ; delimiter
case $1 in
[a-z] ) echo " The input is an alphabet " ;; # Terminator in the case option
[0-9] ) echo " The input is a number" ;;
* ) echo " The input is neither an alpabet or a number ";;
esac
#!/bin/bash
# This script is to explain the usage of the ; as a special character in bash.
# Sijo George
#--------------------------START-------------------------------
echo "Hello world,"; echo "How are you?"; # Execute two commands in a line using a ; delimiter
case $1 in
[a-z] ) echo " The input is an alphabet " ;; # Terminator in the case option
[0-9] ) echo " The input is a number" ;;
* ) echo " The input is neither an alpabet or a number ";;
esac
Labels:
bash,
Linux,
scripting,
special characters at bash prompt
Thursday, July 17, 2008
Usage of Special character '#' at bash
Read through the script below. This better explains the usage
#!/bin/bash
# This script is to explain the special char #
# Sijo George sijo.george@gmail.com
#------------------START------------------------#
#This is a comment
echo "This is #not a comment"
echo 'This also # is not a comment'
echo But ...This is a #comment
echo However This \# is not a comment
echo "Parameter sub is not a comment"
echo ${PATH}
echo ${PATH#*:};# Cuts of the shortest string of pattern after the # from the front
echo ${PATH##*:};# Cuts of the longest string of pattern after the # from the front
echo "Base conversion is not a comment "
echo $((2#1010)) # Convers binary 1010 to decimal
echo $((16#ABCD)) # Converts hex ABCD to decimal
string="this is a string"
echo ${#string} # Gives the number of characters in the string
array=(1 test a 10)
echo ${#array} # Gives the length of first element of the array
echo ${#array[*]} # Gives the number of elements in the array
echo ${#array[@]} # Gives the number of elements in the array
echo ${#} # Gives the number of command line parameters.
echo ${#*} #Gives the number of command line parameters.
echo ${#@} #Gives the number of command line parameters.
#!/bin/bash
# This script is to explain the special char #
# Sijo George sijo.george@gmail.com
#------------------START------------------------#
#This is a comment
echo "This is #not a comment"
echo 'This also # is not a comment'
echo But ...This is a #comment
echo However This \# is not a comment
echo "Parameter sub is not a comment"
echo ${PATH}
echo ${PATH#*:};# Cuts of the shortest string of pattern after the # from the front
echo ${PATH##*:};# Cuts of the longest string of pattern after the # from the front
echo "Base conversion is not a comment "
echo $((2#1010)) # Convers binary 1010 to decimal
echo $((16#ABCD)) # Converts hex ABCD to decimal
string="this is a string"
echo ${#string} # Gives the number of characters in the string
array=(1 test a 10)
echo ${#array} # Gives the length of first element of the array
echo ${#array[*]} # Gives the number of elements in the array
echo ${#array[@]} # Gives the number of elements in the array
echo ${#} # Gives the number of command line parameters.
echo ${#*} #Gives the number of command line parameters.
echo ${#@} #Gives the number of command line parameters.
Thursday, February 21, 2008
Keyboard shortcuts at bash prompt
Alt + < - Move to the first line in the history
Alt + > - Move to the last line in the history
Alt + ? - Show current completion list
Alt + * - Insert all possible completions
Alt + / - Attempt to complete filename
Alt + . - Yank last argument to previous command
Alt + b - Move backward
Alt + c - Capitalize the word
Alt + d - Delete word
Alt + f - Move forward
Alt + l - Make word lowercase
Alt + n - Search the history forwards non-incremental
Alt + p - Search the history backwards non-incremental
Alt + r - Recall command
Alt + t - Move words around
Alt + u - Make word uppercase
Alt + backspace - Delete backward from cursor
Ctrl + a - Jump to the start of the line
Ctrl + b - Move back a char
Ctrl + c - Terminate the command
Ctrl + d - Delete from under the cursor
Ctrl + e - Jump to the end of the line
Ctrl + f - Move forward a char
Ctrl + k - Delete to EOL
Ctrl + l - Clear the screen
Ctrl + r - Search the history backwards
Ctrl + R - Search the history backwards with multi occurrence
Ctrl + u - Delete backward from cursor
Ctrl + xx - Move between EOL and current cursor position
Ctrl + x @ - Show possible hostname completions
Ctrl + z - Suspend/ Stop the command
Alt + > - Move to the last line in the history
Alt + ? - Show current completion list
Alt + * - Insert all possible completions
Alt + / - Attempt to complete filename
Alt + . - Yank last argument to previous command
Alt + b - Move backward
Alt + c - Capitalize the word
Alt + d - Delete word
Alt + f - Move forward
Alt + l - Make word lowercase
Alt + n - Search the history forwards non-incremental
Alt + p - Search the history backwards non-incremental
Alt + r - Recall command
Alt + t - Move words around
Alt + u - Make word uppercase
Alt + backspace - Delete backward from cursor
Ctrl + a - Jump to the start of the line
Ctrl + b - Move back a char
Ctrl + c - Terminate the command
Ctrl + d - Delete from under the cursor
Ctrl + e - Jump to the end of the line
Ctrl + f - Move forward a char
Ctrl + k - Delete to EOL
Ctrl + l - Clear the screen
Ctrl + r - Search the history backwards
Ctrl + R - Search the history backwards with multi occurrence
Ctrl + u - Delete backward from cursor
Ctrl + xx - Move between EOL and current cursor position
Ctrl + x @ - Show possible hostname completions
Ctrl + z - Suspend/ Stop the command
Fun with bash - Addition at bash prompt
Addition at bash prompt can be done in many ways. I have managed to collate some of them in the script below. The script below counts from 1 to 14 in 14 different ways. Its fun isn't it. It shows how powerful and feature-rich this simple scripting language is.
#!/bin/bash
n=1;
echo -n "$n, "
let "n = $n + 1"
echo -n "$n, "
: $((n = $n + 1))
echo -n "$n, "
(( n = n + 1 ))
echo -n "$n, "
n=$(($n + 1))
echo -n "$n, "
: $[ n = $n + 1 ]
echo -n "$n, "
n=$[ $n + 1 ]
echo -n "$n, "
let "n++"
echo -n "$n, "
(( n++ ))
echo -n "$n, "
: $(( n++ ))
echo -n "$n, "
: $[ n++ ]
echo -n "$n, "
n=`echo "$n + 1" | bc`
echo -n "$n, "
n=`echo "$n + 1" | bc -l`
echo -n "$n, "
n=`expr $n + 1`
echo "$n"
#!/bin/bash
n=1;
echo -n "$n, "
let "n = $n + 1"
echo -n "$n, "
: $((n = $n + 1))
echo -n "$n, "
(( n = n + 1 ))
echo -n "$n, "
n=$(($n + 1))
echo -n "$n, "
: $[ n = $n + 1 ]
echo -n "$n, "
n=$[ $n + 1 ]
echo -n "$n, "
let "n++"
echo -n "$n, "
(( n++ ))
echo -n "$n, "
: $(( n++ ))
echo -n "$n, "
: $[ n++ ]
echo -n "$n, "
n=`echo "$n + 1" | bc`
echo -n "$n, "
n=`echo "$n + 1" | bc -l`
echo -n "$n, "
n=`expr $n + 1`
echo "$n"
Subscribe to:
Posts (Atom)