Context-switching - vmstat

 
Thread Tools Search this Thread
Homework and Emergencies Homework & Coursework Questions Context-switching - vmstat
# 1  
Old 10-05-2010
Context-switching - vmstat

1. The problem statement, all variables and given/known data:

Type
`vmstat -s; vmstat -n 1 5; vmstat -n 1 5; vmstat
-s`
to your Ruby interpreter. Then terminate your Ruby session. Run the Unix com-
mand
vmstat -s; vmstat -n 1 5; vmstat -s in the same terminal window you had
been using for Ruby. Did the context-switching rate of your system change signi cantly,

after the Ruby interpreter was shut down? Explain briey.


2. Relevant commands, code, scripts, algorithms:

3. The attempts at a solution (include all code and scripts):


So what i did is:
After typing this command "vmstat -s; vmstat -n 15; vmstat -n 15; vmstat -s"

I found 2 context switches. The one is 707227535 and the other one is 707222952. I substracted them and divided by 10 as the "vmstat -n 1 5" five times in duration of one second per line. Because it does this 2 times than my calculation looks like that:

context switches per second = (707227535-707222952)/(2x5)=458

After terminating Ruby interpreter i typed: "vmstat -s; vmstat -n 1 5; vmstat -s"

and the calculation goes like that:

context switches per second = (707306157-707303877)/5=456

The questions are:

1. Am i doing the right calculations for context switches?
2. What does it mean that the resolt in both cases is so close to each other?

Thank you with advance.


4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):

University of Auckland
Auckland City
New Zealand
Clark Thomborson
# 2  
Old 10-11-2010
I believe that you are doing the correct calculations, though the sample time is much too short to be meaningful.

As long as you are the sole user of the computer on which you ran "vmstat" we could deduce that your Ruby session was not a major hit on that particular system resource. So what?

Personally I could not deduce anything significant from these statistics with such a small sample.

Now, if you ran a process for an hour and could see a distinct change in context switches that might be worth investigating.


Other posters may wish to comment.
# 3  
Old 10-11-2010
Thank you methyl. I'm very appreciate for your help. It obviously make sense and thats exactly what i was thinking.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Questions related to if in awk context and if without awk context

I wrote this code, questions follow #! /bin/bash -f # Purpose - to show how if syntax is used within an awk clear; ls -l; echo "This will print out the first two columns of the inputted file in this directory"; echo "Enter filename found in this directory"; read input; ... (11 Replies)
Discussion started by: Seth
11 Replies

2. Shell Programming and Scripting

Confusion with "su -c" and quotes, user context switching?

Trying to execute commands for different Unix user with that user's environment variable context without fully switching as that user using sudo && su capabilities. Hoping this would help with security and not having to waste time switching between 10 different app users on same server. I do... (6 Replies)
Discussion started by: kchinnam
6 Replies

3. UNIX for Advanced & Expert Users

Interupt Context Switching

If suppose a middle level interrupt is being serviced and a high priority interrupts comes in then in that case what all process will take place. The interrupt context switch will happen. But where will the interrupt context be saved? Is there something called as part process data area? (4 Replies)
Discussion started by: rupeshkp728
4 Replies

4. Linux

involuntary context switching

In a kernel based on 2.6.27: In the schedule() routine they have a local variable switch_count: /* * schedule() is the main scheduler function. */ asmlinkage void __sched schedule(void) { struct task_struct *prev, *next; unsigned long *switch_count; struct rq... (2 Replies)
Discussion started by: chriskot
2 Replies

5. Homework & Coursework Questions

context-switching - vmstat

Hi all, I've got this question that i need to solve: "Type `vmstat -s; vmstat -n 1 5; vmstat -n 1 5; vmstat -s` to your Ruby interpreter. Then terminate your Ruby session. Run the Unix com- mand vmstat -s; vmstat -n 1 5; vmstat -s in the same terminal window you had been using for Ruby. Did... (1 Reply)
Discussion started by: snowboarder
1 Replies

6. UNIX for Advanced & Expert Users

contex-switching - vmstat

Hi all, I've got this question that i need to solve: "Type `vmstat -s; vmstat -n 1 5; vmstat -n 1 5; vmstat -s` to your Ruby interpreter. Then terminate your Ruby session. Run the Unix com- mand vmstat -s; vmstat -n 1 5; vmstat -s in the same terminal window you had been using for Ruby. Did... (1 Reply)
Discussion started by: snowboarder
1 Replies

7. UNIX for Dummies Questions & Answers

Context-switching question

Hi all, I've got this question that i need to solve: "Type `vmstat -s; vmstat -n 1 5; vmstat -n 1 5; vmstat -s` to your Ruby interpreter. Then terminate your Ruby session. Run the Unix com- mand vmstat -s; vmstat -n 1 5; vmstat -s in the same terminal window you had been using for Ruby. Did... (1 Reply)
Discussion started by: snowboarder
1 Replies

8. Shell Programming and Scripting

grep help after context

Hi, There's a file with below contents which I have to read based on the input parameter provided by the user. FILE_ID=1 FILE_FTP_ID=ftp.server1.com FILE_FTP_USER=user1 FILE_FTP_PASS=pass1 FILE_ID=2 FILE_FTP_ID=ftp.server2.com FILE_FTP_USER=user2 FILE_FTP_PASS=pass2 FILE_ID=3... (6 Replies)
Discussion started by: dips_ag
6 Replies

9. Shell Programming and Scripting

keep context in awk

here is a data file. ------------------------------------- KSH, CSH, BASH, PERL, PHP, SED, AWK KSH, CSH, BASH, PERL, PHP, BASH, PERL, PHP, SED, AWK CSH, BASH, PERL, PHP, SED, KSH, CSH, BASH, PERL, PHP, SED, AWK ------------------------------------- My desired output is... (2 Replies)
Discussion started by: VTAWKVT
2 Replies

10. UNIX for Advanced & Expert Users

Context Switching

I know that this is a relative question but can someone give me an idea of what would be considered a high number of context switches? I am running vmstat and show a cs value of between 5000 and 6000 on a 4 processor system. How can I deduce if this number is high or not? Also, the timeslice... (2 Replies)
Discussion started by: keelba
2 Replies
Login or Register to Ask a Question