Re: Question on schedule() function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fawad Lateef wrote:

Can you explain what you are doing ??? like how u are sharing buffer
b/w user/kernel space,

I allocate the buffer in the driver, and the application calls mmap() to get a pointer to it.

> whats the method of polling b/c you are saying
completely de-coupling the driver from the simulator ???

The simulator has a bunch of threads that just run on their own, constantly polling the memory buffer looking for when something has changed. It's inefficient, but it more closely matches how the real hardware works.

Whats your driver do ???

It's a standard network driver.

Is it working constantly means in a loop ??

No, I was talking about the simulator.

The driver writes data to the memory buffer, and it's supposed to wait until the simulator writes the response back to the same memory buffer. I just want to know if schedule() will cause the driver to go to sleep, and give CPU to the simulator application.

Basically, I want to know if the following code will work:

*buffer =100;
while (*buffer == 100) {
	schedule();
}

What I want to know is whether the schedule() call will give CPU time to the simulator, which is running as a user-space process. When the simulator runs, it sees that the buffer has the value 100, and then it does some calculations, and writes a different value back to the buffer. This should cause "*buffer == 100" to become false.

--
Timur Tabi
Staff Software Engineer
timur.tabi@xxxxxxxxxxx

One thing a Southern boy will never say is,
"I don't think duct tape will fix it."
     -- Ed Smylie, NASA engineer for Apollo 13

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux