First we divide the large memory into some chunks and we hash them. For each chunk, we need hash function. If a thread accesses a memory location, we find which chunk of address it is accessing, then we hash based on memory location. We can easily identify what are all threads are accessing a memory location at a time...
On Sat, Mar 31, 2012 at 12:09 PM, Dheeraj Sharma < [email protected]> wrote: > MS IDC interview question: > > Given a memory location say from 0 - 1023. Now there are many threads that > are reading and writing in this memory locations at any time 0t 1t 2t ... > and so on. > > For ex a thread no.4 is writing to memory location 512 at time 3t. > So we get a quadruple {4,512,W,3t}. > > Suppose we have lot of quadruples for lots of threads.At any particular > time we have to tell which of the threads are doing memory clash. > > Memory clash is defined as two thread accessing same memory location with > time difference less than equal to 5 and atleast one of the thread is doing > write operation. > > That interviewer didnt needed the code bt the approach.I first told him to > hash the threads based on memory location and search for memory clash > threads for that memory location,bt he was not understanding how it can be > implemented for large no. of threads. > -- > *Dheeraj Sharma* > > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- **Regards * * <[email protected]> Bharat B | M.Tech II | C.S.E | IITM * * *Ph: +91 8056127652* -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
