[algogeeks] Re: OS question..
see, ideally for Q1, the answer the NO. But paging has some advantage, therefore its better to have it neverthless Q2, ?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/44rIrz0Vil8J. To post to this group, send email to algogeeks@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] Re: OS
@Sanket: You are wrong. Check the loops again! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/ifxkh_x5o0EJ. To post to this group, send email to algogeeks@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] Re: OS
@Mihir - Yea, I missed the semi-colon, got it now :-) On Jun 27, 2:00 am, Mihir mihirmpa...@gmail.com wrote: @Sanket: You are wrong. Check the loops again! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@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] Re: OS
I don't think this ensures mutual exclusion. Consider this sequence of execution: 1. P1 - while (true) 2. P2 - while (true) 3. P1 - wants1 = true 4. P2 - wants2 = true 5. P1 - while (wants2 == true) //This will evaluate to true because of step 4 6. P2 - while (wants1 == true) //This will evaluate to true because of step 3 7. P1 - enter critical section 8. P2 - enter critical section Since A is true, C and D are false. I am not sure about B. On Jun 22, 12:54 am, sachin sharma sachin.bles...@gmail.com wrote: @Rahul Threads within a process share the same virtual memory space but each has a separate stack, and possibly thread-local storage. this thread local storage is register and other private data. They are *lightweight* because a context switch is simply a case of switching the stack pointer and program counter and restoring other registers, wheras a *process*context switch involves switching the MMU context as well. Moreover, communication between threads within a process is *lightweight* because they share an address space. Now Option A is not right as it says Only register. Option B is wrong as it directly opposes Option C is correct as Threads share address space of Process. Virtually memory is concerned with processes not with Threads Option D is wrong as it says only scheduling and accounting. Best Wishes Sachin Sharma University of Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@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] Re: OS
got it! thanks :) On Mon, Jun 20, 2011 at 6:07 PM, MONSIEUR monsieur@gmail.com wrote: why it will be truehow does it guarantee that strict alterationif p1 comes and finishes and again comes,it will be served no matter whether p2 is executed or not On Jun 19, 6:31 pm, Akshata Sharma akshatasharm...@gmail.com wrote: Why is C not true? On Sun, Jun 19, 2011 at 6:31 PM, sanjay ahuja sanjayahuja.i...@gmail.comwrote: B and D are true On Sun, Jun 19, 2011 at 5:43 PM, Nishant Mittal mittal.nishan...@gmail.com wrote: It does not prevent deadlock so i think (D) is definitely true. On Sun, Jun 19, 2011 at 5:15 PM, Akshata Sharma akshatasharm...@gmail.com wrote: Two processes, P1 and P2, need to access a critical section of code. Consider the following synchronization construct used by the processes: /* P1 */ while (true) { wants1 = true; while (wants2==true); /* Critical Section */ wants1=false; } /* Remainder section */ /* P2 */ while (true) { wants2 = true; while (wants1==true); /* Critical Section */ Wants2=false; } /* Remainder section */ Here, wants1 and wants2 are shared variables, which are initialized to false. Which one of the following statements is TRUE about the above construct? (A) It does not ensure mutual exclusion. (B) It does not ensure bounded waiting. (C) It requires that processes enter the critical section in strict alternation. (D) It does not prevent deadlocks, but ensures mutual exclusion. I think B,C are true. It also prevents deadlock so D is also true, not sure though. Am I right? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@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. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@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. -- Sanjay Ahuja, Analyst, Financing Prime Brokerage Nomura Securities India Pvt. Ltd -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@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. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@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. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@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] Re: OS doubt
Which book are you studying for OS ? -- 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] Re: OS doubt
On Jun 12, 1:22 pm, amit amitjaspal...@gmail.com wrote: OS doubt: I have read many times that say a 24 KB process enters the Main Memory selected by the Long Term Scheduler. But I don't understand what it exactly means. As far as I know Process consists of ( Code + Data(Static) + Stack(Local Data) + Heap) So doubt1: Is this 24 KB the size of this whole process or just the size of the code segment. I don't know buddy.. doubt2: Now lets say this process starts getting executed by the CPU ,Suppose the main() contains main(){ int x; int y; x=10; ... } So x,y will be allocated the memory in the Stack. But when x=10 is encountered , how will the CPU know the address of x. In short how is x accessed?? buddycpu will never encounter what u have written(meansx). Compiler converts this to machine languages, cpu can easily access using relative address. doubt 3: If x and y are just address of a memory location in the stack , can their logical address be determined by the compiler or it will be generated by the CPU?? compiler can generate logical address -- 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] Re: os
So can we say that a mutex is a binary semaphore. On Thu, Jun 10, 2010 at 11:26 PM, souravsain souravs...@gmail.com wrote: Originally semaphore is a concept given by Dijkstra who says it is something that can have two operations P and V both atomic. In an OS (for example Unix) we have kernal objects called semaphore which have the same two atomic oprerations. It is used to control communication between 2 things (it can be 2 thread, 2 processes) as you have rightly mentioned. You can 'wait' for a semaphore. Someone else (thread/process) can broadcast a message that it has freed a semaphore. So emphasis is on communication. Mutex is more for controlling access to some resource. I do not know how many threads will access an object, say a linked list. What I only know is that the linked list should not be manipulated simultaneously by 2 or more threads. So my focus is on makeing sure than the shared object 'linked list' is in good shape. So a Mutex is in itself an object which sort of guards the resoure. So the mutex says If a thread wants to access / change the linked list, first lock me, then do ur changes and unlock me. Having said this, Binary semaphore is one which can change value between 2 states (enerally 1 and 0) and most interestingly, we implement a mutex object by having a binary semaphore inside the Mutex object. class Mutex { private BinSem MySem; lock() { if MySem is 0 then lock or wait } unlock() { if MySem is 1 broadcast all am releasing and release. } } On Jun 10, 8:56 pm, sharad kumar sharad20073...@gmail.com wrote: @sharad but when it is binary semaphore then only one process is accessing the resource,rest all are blockedwhich means that only that process who locked bin. sem will unlock it .plzzz correct me if i m wrong -- 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. -- Regards, Rishi B. Agrawal http://www.linkedin.com/in/rishibagrawal http://code.google.com/p/fscops/ -- 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] Re: os
Originally semaphore is a concept given by Dijkstra who says it is something that can have two operations P and V both atomic. In an OS (for example Unix) we have kernal objects called semaphore which have the same two atomic oprerations. It is used to control communication between 2 things (it can be 2 thread, 2 processes) as you have rightly mentioned. You can 'wait' for a semaphore. Someone else (thread/process) can broadcast a message that it has freed a semaphore. So emphasis is on communication. Mutex is more for controlling access to some resource. I do not know how many threads will access an object, say a linked list. What I only know is that the linked list should not be manipulated simultaneously by 2 or more threads. So my focus is on makeing sure than the shared object 'linked list' is in good shape. So a Mutex is in itself an object which sort of guards the resoure. So the mutex says If a thread wants to access / change the linked list, first lock me, then do ur changes and unlock me. Having said this, Binary semaphore is one which can change value between 2 states (enerally 1 and 0) and most interestingly, we implement a mutex object by having a binary semaphore inside the Mutex object. class Mutex { private BinSem MySem; lock() { if MySem is 0 then lock or wait } unlock() { if MySem is 1 broadcast all am releasing and release. } } On Jun 10, 8:56 pm, sharad kumar sharad20073...@gmail.com wrote: @sharad but when it is binary semaphore then only one process is accessing the resource,rest all are blockedwhich means that only that process who locked bin. sem will unlock it .plzzz correct me if i m wrong -- 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.