[algogeeks] 400!

2010-05-01 Thread divya
give an algo to calculate 300! or even 400!

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Where does OS scheduling run??

2010-05-01 Thread praba garan
Hi all,
I have a doubt in OS.
The scheduler does the process of preemption.
And one processor can run atmost 1 instruction at a time.
Then how  where does the scheduler run??

With Regards,
Prabagaran.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Where does OS scheduling run??

2010-05-01 Thread Guillermo Garcia
The scheduler takes control with a clock interruption. Then it analyzes if
it has to preempt or not the running task.

On Sat, May 1, 2010 at 5:00 PM, praba garan prabagara...@gmail.com wrote:

 Hi all,
 I have a doubt in OS.
 The scheduler does the process of preemption.
 And one processor can run atmost 1 instruction at a time.
 Then how  where does the scheduler run??

 With Regards,
 Prabagaran.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Where does OS scheduling run??

2010-05-01 Thread Guillermo Garcia
read here - http://en.wikipedia.org/wiki/Preemption_%28computing%29



Time slice

The period of time for which a process is allowed to run in a preemptive
multitasking system is generally called the *time slice*, or *quantum*. The
scheduler is run once every time slice to choose the next process to run. If
the time slice is too short then the scheduler will consume too much
processing time.

An interrupt http://en.wikipedia.org/wiki/Interrupt is scheduled to allow
the operating system http://en.wikipedia.org/wiki/Operating_system
kernelhttp://en.wikipedia.org/wiki/Kernel_%28computer_science%29to
switch between processes when their time slices expire, effectively
allowing the processor’s time to be shared between a number of tasks, giving
the illusion that it is dealing with these tasks simultaneously, or
concurrently. The operating system which controls such a design is called a
multi-tasking system.




On Sat, May 1, 2010 at 5:26 PM, praba garan prabagara...@gmail.com wrote:

 @ Guillermo Garcia

 Suppose a user program is executing and and clock interrupt arrives..
 Then who receives the interrupt??
 Can you xplain me the clock interrupt(like any hardwares involved) bit
 detailed??

 With Regards,
 Prabagaran.



 On Sun, May 2, 2010 at 1:38 AM, Guillermo Garcia gegarci...@gmail.comwrote:

 The scheduler takes control with a clock interruption. Then it analyzes if
 it has to preempt or not the running task.

 On Sat, May 1, 2010 at 5:00 PM, praba garan prabagara...@gmail.comwrote:

 Hi all,
 I have a doubt in OS.
 The scheduler does the process of preemption.
 And one processor can run atmost 1 instruction at a time.
 Then how  where does the scheduler run??

 With Regards,
 Prabagaran.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Where does OS scheduling run??

2010-05-01 Thread praba garan
@ Guillermo Garcia

The link gives the overall abstract idea.
I am talking in register level.
When a user process executes

1. PC program counter will contain the address of the next instruction in
user code.
2. Processor registers(accumulator ...) contain the current instruction
data.

Then where does the interrupt actually arrives??

And by that time the user process the control, then who does the preempting
and how??

With Regards,
Prabagaran.


On Sun, May 2, 2010 at 2:35 AM, Guillermo Garcia gegarci...@gmail.comwrote:


 read here - http://en.wikipedia.org/wiki/Preemption_%28computing%29



 Time slice

 The period of time for which a process is allowed to run in a preemptive
 multitasking system is generally called the *time slice*, or *quantum*.
 The scheduler is run once every time slice to choose the next process to
 run. If the time slice is too short then the scheduler will consume too much
 processing time.

 An interrupt http://en.wikipedia.org/wiki/Interrupt is scheduled to
 allow the operating system http://en.wikipedia.org/wiki/Operating_system
 kernel http://en.wikipedia.org/wiki/Kernel_%28computer_science%29 to
 switch between processes when their time slices expire, effectively allowing
 the processor’s time to be shared between a number of tasks, giving the
 illusion that it is dealing with these tasks simultaneously, or
 concurrently. The operating system which controls such a design is called a
 multi-tasking system.




 On Sat, May 1, 2010 at 5:26 PM, praba garan prabagara...@gmail.comwrote:

 @ Guillermo Garcia

 Suppose a user program is executing and and clock interrupt arrives..
 Then who receives the interrupt??
 Can you xplain me the clock interrupt(like any hardwares involved) bit
 detailed??

 With Regards,
 Prabagaran.



 On Sun, May 2, 2010 at 1:38 AM, Guillermo Garcia gegarci...@gmail.comwrote:

 The scheduler takes control with a clock interruption. Then it analyzes
 if it has to preempt or not the running task.

 On Sat, May 1, 2010 at 5:00 PM, praba garan prabagara...@gmail.comwrote:

 Hi all,
 I have a doubt in OS.
 The scheduler does the process of preemption.
 And one processor can run atmost 1 instruction at a time.
 Then how  where does the scheduler run??

 With Regards,
 Prabagaran.

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] value of n

2010-05-01 Thread Amir hossein Shahriari
this equation is true for 32 but not for 64 so i used a linear search
for 43 the right side is 43.410118 and for 44 its 43.675453
so this equation means n44

On Sat, May 1, 2010 at 9:43 AM, Amit Agarwal lifea...@gmail.com wrote:

 I could not get you properly. This is an equation comes from the problem
 statement where I need to find out cut-off value of n between insertion and
 merge sort. I think equation is part of basic mathematics but I don't
 remember how do I solve it.


 -Regards
 Amit Agarwal
 Contact: 09765348182
 www.amitagrwal.com




 On Sat, May 1, 2010 at 9:13 AM, abhijith reddy 
 abhijith200...@gmail.comwrote:

 binary search on n

 On Fri, Apr 30, 2010 at 10:15 PM, Amit Agarwal lifea...@gmail.comwrote:

 how do I compute n from this equation.
 n  8lg(n)

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] 400!

2010-05-01 Thread Rajesh Patidar
take an long array of integer (to store the answer)
let Mod=1 (maximum allowable size or number in the array element
initialize the last element of array with 1
and know start multiplying the 1--n into the last number to first of array
if any number crosses the given then take
 m=a[i]/mod
and set a[i]=a[i]%Mod;
 and add m to the next adjacent element

eg let calculating 5!
taken an array of integer and Mod=10
A={0,0,1}
mutliplying 1 in all from the back side
A={0,0,1}
multiplying 2
A={0,0,2}
multiplying 3
A={0,0,6}
multiplying 4
the number in the last element goes 24
so setting 24%10 =4 stetting it into the that element and adding
24/10=2 to the next
A=[0,2,4}
multiplying 5
4*5=20(setting 0 and adding 2 to next}
2*5+2=12(setting 2 and adding 1 to next)
0*5+1=1
so A={1,2,0}


On Sat, May 1, 2010 at 3:06 PM, divya sweetdivya@gmail.com wrote:
 give an algo to calculate 300! or even 400!

 --
 You received this message because you are subscribed to the Google Groups 
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to 
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/algogeeks?hl=en.





-- 
BL/\CK_D!AMOND

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] value of n

2010-05-01 Thread Afroz Mohiuddin
An easy way to do would be to plot both functions in matlab, n and 8log(n)
... just see when y = x is below y = 8log(x) happens between 3= n = 25
if log is to natural base  if it was log base 2 ... 3= n = 43

On Sat, May 1, 2010 at 10:43 AM, Amit Agarwal lifea...@gmail.com wrote:

 I could not get you properly. This is an equation comes from the problem
 statement where I need to find out cut-off value of n between insertion and
 merge sort. I think equation is part of basic mathematics but I don't
 remember how do I solve it.


 -Regards
 Amit Agarwal
 Contact: 09765348182
 www.amitagrwal.com




 On Sat, May 1, 2010 at 9:13 AM, abhijith reddy 
 abhijith200...@gmail.comwrote:

 binary search on n

 On Fri, Apr 30, 2010 at 10:15 PM, Amit Agarwal lifea...@gmail.comwrote:

 how do I compute n from this equation.
 n  8lg(n)

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
We are here on earth to do good for others. What the others are here for, I
don't know.

Afroz Mohiuddin
Final Year Masters Student
Dept Computer Science and Engineering
Indian Institute of Technology Kanpur
Kanpur - 208016
INDIA

Address:  F-112 Hall 9
Telephone: [91]9838773891
Email: afrozena...@gmail.com
  a...@iitk.ac.in
  a...@cse.iitk.ac.in

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] a google question

2010-05-01 Thread Algoose Chase
@mohit

The idea of DP is fine.
When you find the Max i dont think you need to include A[i+1]+B[j+1] because
it can never be greater than both A[i+1]+B[j] and A[i]+B[j+1] since both the
lists are sorted in decreasing order.


On Fri, Apr 30, 2010 at 8:47 PM, mohit ranjan shoonya.mo...@gmail.comwrote:

 oops

 Sorry didn't read properly
 last algo was for array sorted in ascending order

 for this case, just reverse the process


 A[n] and B[n] are two array

 loop=n, i=0, j=0;


 while(loop0)  // for n largest pairs
 {
   print A[i]+B[j];  // sum of first index from both array will be
 max

   foo = MAX ( A[i+1]+B[j], A[i+1]+B[j+1], A[i]+B[j+1] ) // using DP,
 moving forward

   if foo==A[i+1]+B[j]; i++   // only increment A
   if foo==A[i+1]+B[j+1]; i++; j++   // increment both A and B
   if foo==A[i]+B[j+1]; j++  // increment only B

 }



 Mohit Ranjan
 Samsung India Software Operations.


 On Fri, Apr 30, 2010 at 8:40 PM, mohit ranjan shoonya.mo...@gmail.comwrote:

 Hi Divya,


 A[n] and B[n] are two array

 loop=n, i=n-1, j=n-1;

 while(loop0)  // for n largest pairs
 {
   print A[i]+B[j];  // sum of last index from both array will be
 max

   foo = MAX ( A[i-1]+B[j], A[i-1]+B[j-1], A[i]+B[j-1] ) // using DP
 moving backward

   if foo=A[i-1]+B[j]; i--   // only reduce A
   if foo=A[i-1]+B[j-1]; i--; j--   // reduce both A and B
   if foo=A[i]+B[j-1]; j--  // reduce only B
 }

 Time: O(n)


 Mohit Ranjan



 On Fri, Apr 30, 2010 at 5:35 PM, divya sweetdivya@gmail.com wrote:

 Given two sorted postive integer arrays A(n) and B(n) (W.L.O.G, let's
 say they are decreasingly sorted), we define a set S = {(a,b) | a \in
 A
 and b \in B}. Obviously there are n^2 elements in S. The value of such
 a pair is defined as Val(a,b) = a + b. Now we want to get the n pairs
 from S with largest values. The tricky part is that we need an O(n)
 algorithm.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Where does OS scheduling run??

2010-05-01 Thread pradeep verma
lets suppose Processor executing a instruction(process1) and another
process2 tries to take the control of CPU so inorder to inform CPU it has to
interrupt the CPU right
now we know that if interrupt comes CPU stop its current processing and goes
to the interrupt subroutine...now CPU knows that its a pre-emption interrupt
so CPU first run its short term scheduler(this will inform CPU that the
interruting process priority is less or greater ..n if greater than CPU goes
to previous process1 preempt it and start executing higher priority process2
)

I think its clear

Regards
Pradeep


On Sun, May 2, 2010 at 3:06 AM, praba garan prabagara...@gmail.com wrote:

 @ Guillermo Garcia

 The link gives the overall abstract idea.
 I am talking in register level.
 When a user process executes

 1. PC program counter will contain the address of the next instruction in
 user code.
 2. Processor registers(accumulator ...) contain the current instruction
 data.

 Then where does the interrupt actually arrives??

 And by that time the user process the control, then who does the preempting
 and how??

 With Regards,
 Prabagaran.



 On Sun, May 2, 2010 at 2:35 AM, Guillermo Garcia gegarci...@gmail.comwrote:


 read here - http://en.wikipedia.org/wiki/Preemption_%28computing%29



 Time slice

 The period of time for which a process is allowed to run in a preemptive
 multitasking system is generally called the *time slice*, or *quantum*.
 The scheduler is run once every time slice to choose the next process to
 run. If the time slice is too short then the scheduler will consume too much
 processing time.

 An interrupt http://en.wikipedia.org/wiki/Interrupt is scheduled to
 allow the operating systemhttp://en.wikipedia.org/wiki/Operating_system
 kernel http://en.wikipedia.org/wiki/Kernel_%28computer_science%29 to
 switch between processes when their time slices expire, effectively allowing
 the processor’s time to be shared between a number of tasks, giving the
 illusion that it is dealing with these tasks simultaneously, or
 concurrently. The operating system which controls such a design is called a
 multi-tasking system.




 On Sat, May 1, 2010 at 5:26 PM, praba garan prabagara...@gmail.comwrote:

 @ Guillermo Garcia

 Suppose a user program is executing and and clock interrupt arrives..
 Then who receives the interrupt??
 Can you xplain me the clock interrupt(like any hardwares involved) bit
 detailed??

 With Regards,
 Prabagaran.



 On Sun, May 2, 2010 at 1:38 AM, Guillermo Garcia 
 gegarci...@gmail.comwrote:

 The scheduler takes control with a clock interruption. Then it analyzes
 if it has to preempt or not the running task.

 On Sat, May 1, 2010 at 5:00 PM, praba garan prabagara...@gmail.comwrote:

 Hi all,
 I have a doubt in OS.
 The scheduler does the process of preemption.
 And one processor can run atmost 1 instruction at a time.
 Then how  where does the scheduler run??

 With Regards,
 Prabagaran.

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm 

Re: [algogeeks] Where does OS scheduling run??

2010-05-01 Thread Guillermo Garcia
correct, and in each process switch, the process state (registers, etc. ) is
stored so when the scheduler wants to go back to execute such process, it
restores it to the state exactly before its execution was interrupted


On Sat, May 1, 2010 at 7:32 PM, pradeep verma ppradeep...@gmail.com wrote:

 lets suppose Processor executing a instruction(process1) and another
 process2 tries to take the control of CPU so inorder to inform CPU it has to
 interrupt the CPU right
 now we know that if interrupt comes CPU stop its current processing and
 goes to the interrupt subroutine...now CPU knows that its a pre-emption
 interrupt so CPU first run its short term scheduler(this will inform CPU
 that the interruting process priority is less or greater ..n if greater than
 CPU goes to previous process1 preempt it and start executing higher priority
 process2 )

 I think its clear

 Regards
 Pradeep



 On Sun, May 2, 2010 at 3:06 AM, praba garan prabagara...@gmail.comwrote:

 @ Guillermo Garcia

 The link gives the overall abstract idea.
 I am talking in register level.
 When a user process executes

 1. PC program counter will contain the address of the next instruction in
 user code.
 2. Processor registers(accumulator ...) contain the current instruction
 data.

 Then where does the interrupt actually arrives??

 And by that time the user process the control, then who does the
 preempting and how??

 With Regards,
 Prabagaran.



 On Sun, May 2, 2010 at 2:35 AM, Guillermo Garcia gegarci...@gmail.comwrote:


 read here - http://en.wikipedia.org/wiki/Preemption_%28computing%29



 Time slice

 The period of time for which a process is allowed to run in a preemptive
 multitasking system is generally called the *time slice*, or *quantum*.
 The scheduler is run once every time slice to choose the next process to
 run. If the time slice is too short then the scheduler will consume too much
 processing time.

 An interrupt http://en.wikipedia.org/wiki/Interrupt is scheduled to
 allow the operating systemhttp://en.wikipedia.org/wiki/Operating_system
 kernel http://en.wikipedia.org/wiki/Kernel_%28computer_science%29 to
 switch between processes when their time slices expire, effectively allowing
 the processor’s time to be shared between a number of tasks, giving the
 illusion that it is dealing with these tasks simultaneously, or
 concurrently. The operating system which controls such a design is called a
 multi-tasking system.




 On Sat, May 1, 2010 at 5:26 PM, praba garan prabagara...@gmail.comwrote:

 @ Guillermo Garcia

 Suppose a user program is executing and and clock interrupt arrives..
 Then who receives the interrupt??
 Can you xplain me the clock interrupt(like any hardwares involved) bit
 detailed??

 With Regards,
 Prabagaran.



 On Sun, May 2, 2010 at 1:38 AM, Guillermo Garcia 
 gegarci...@gmail.comwrote:

 The scheduler takes control with a clock interruption. Then it analyzes
 if it has to preempt or not the running task.

 On Sat, May 1, 2010 at 5:00 PM, praba garan prabagara...@gmail.comwrote:

 Hi all,
 I have a doubt in OS.
 The scheduler does the process of preemption.
 And one processor can run atmost 1 instruction at a time.
 Then how  where does the scheduler run??

 With Regards,
 Prabagaran.

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.