On Thu, May 19, 2005 at 04:15:41 +0100, Dinesh Ahuja wrote: > Hi All, > > I am implementing Blocking I/O techniques in device > driver and want to understand the fu nctionality of > schedule() function i.e how the process [ represented > by task_struct ] switch from wait_queue to run_queue. > > To understand the code flow, i want to adopt the > simplest technique which is quick and effective. If I > put printk() in schedule() function, i need to compile > the kernel which i somewhat time consuming. Is there > any easier way so that I can understand the flow from > the module to kernel code and could see what is code > flow in kernel. You can build user-mode-linux, to which you can attach debugger. It's a hell lot safer than playing with live kernel and you don't need to work as root. On the other hand, I don't see what's the problem. From module's point of view, schedule() is a thing, that sleeps for some time (and the CPU is doing other work meanwhile). You just have to note, that the other thing can be your module called on behalf of other process. When schedule() returns is controlled by the task state. IIRC set_current_state() is the appropriate macro to set that. Btw., most of the time you don't want to call schedule() directly, but rather with wait_event (or wait_event_interruptible) or do semaphore or completion operations. > Another question is , i need to access runqueue from > my module, but the kernel doesnot export the functions > needs to work on runqueue. Please guide me how to > accesses functions which are not exported by kernel in > kernel module. I am quite sure you neither need nor want to access the runqueue. You may want to make process go to different queues, but that's done by setting their state. Or, even more probably, hidden in wait_event and wake_up. ------------------------------------------------------------------------------- Jan 'Bulb' Hudec <bulb@xxxxxx>
Attachment:
signature.asc
Description: Digital signature