首页 > 科技 > Runlevel – morning / iostat – afternoon

Runlevel – morning / iostat – afternoon

2005年7月19日 21点44分 发表评论 阅读评论

1st: Runlevel – morning
A runlevel is a software configuration of the system which allows only a select group of processes to exist.The processes spawned by init for each of these runlevels are defined in the /etc/inittab file. Init can be in one of eight runlevels: 0-6 and S or s.The runlevel is changed by having a privileged user run telinit,which sends appropriate signals to init,telling it which runlevel to change to.

Runlevels 0,1 and 6 are reserved.Runlevel 0 is used to halt the system,runlevel 6 is used to reboot the system,and runlevel 1 is used to get the system down into single user mode.Runlevel S is not really meant to be used directly,but more for the scripts that are executed when entering runlevel 1. S or s will bring system to single user mode and do not require /etc/inittab.

Init is invoked, as the last step of the kernel boot sequence,it looks for the file /etc/inittab to see if there is an entry of the type initdefault.

When starting a new process,init first checks whether the file /etc/inittab script exists,if it does,it uses this script to start the process.Each time a child terminates,init records the fact and the reason it died in /var/run/utmp and /var/log/wtmp provided that these files exist.

After it has spawned all of the processes specified,init waits for one of its descendant processes to die, a powerful signal or until it is signaled by telinit to change the system’s runlevel.When one of the above three conditions occurs,it re-examinates the /etc/inittab file.New entries can be added to this file at any time.However,init still waits for one of the above three conditions to occur.

To provide for an instantaneous response,the telinit Q or q command can wake up init to re-examinate the /etc/inittab file.

I tried some test after reading init command manual.The results are listed here.
init 1 telling INIT to go to single user mode.
init 3 restart the system to run in test mode
init 4 restart those service which is default selected but had been cancelled
init 5 get the system to run in GUI mode
init 6 reboot the system

2nd: iostat – afternoon
The target is to get the transfer rate of harddisk reading and write in Linux.Throught seaching in the internet, I used command “hdparm” in the following way: # hdparm -t -T /dev/sda,but I can only get the report about reading and write data from the cache of the harddisk.It’s not useful.
I had to read more documents in the internet,and then find the command named “iostat”.Issue this command in the terminate: # iostat, and then bash told me there was not iostat existing.So I want to locate the iostat command:
#find -name ‘*stat’,as the result,serveral commands about status are listed in the /usr/bin directory,except iostat.What’s the matter?I thought perhaps the problem had some relation with packages installed.

In the Gnome,clicked icon in the toolbar in the following sequence: Applications – System Setting – Add/Remove applications. I checked the packages one by one, and then found the option which said “sysstat-The sar and iostat” contained in the “System Tools Package Details” item.However,this option is not selected by default.Then,choose this item and run updating program that need RHEL 4.0 installation CD 2 and CD3.
After updated,rebooted the operating system and issued the iostat again.That’s find. A report was printed in the screen.We can get statistic about block mount without no parameters added.The data transfered in kilobyte formation seems more useful for us,we can add “-k” following iostat command.for example,# iostat -k

As Oracle’s statepack,we could get the informating at serveral time interval.

# iostat 2 6

It will display six reports at two seconds interval. I got a low transfer rate when no program was running on the system.By using stress which is a common testing tool for Linux,the rate raised much higher when the stress testing block size was from 1G to 3G:

#stress -c 4 -d 2 --hdd-noclean --hdd-bytes 1G(or 3G later)

(138000kB/s when 3G was defined as parameter)
That was the number what we want to get.

分类: 科技 标签:
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.
您必须在 登录 后才能发布评论.