对多个task_struct结构进行排队?
我想在我的块设备驱动程序中对多个 struct task_struct 进行排队。在这里,每个task_struct
将对应一个用户级线程,该线程使用ioctl()
系统调用将用户空间缓冲区发送到我的块设备驱动程序。一旦我对多个task_struct进行排队,我希望将它们保留在队列中,直到满足特定条件(即缓冲区已被写入磁盘)。
所以,我的问题是,如何对多个 task_struct
进行排队,将它们置于睡眠状态,然后在满足某些条件时唤醒排队的 task_struct
的子集?
I would like to queue up multiple struct task_struct
s in my block device driver. Here, each task_struct
would correspond to a userlevel thread which uses the ioctl()
system call to send a userspace buffer to my block device driver. Once I queue up multiple task_struct
s, I would like to keep them on the queue until a particular condition is met (i.e., the buffer has been written down to the disk).
So, my question is, how do I queue up multiple task_struct
s, put them to sleep, and then wake a subset of the queued task_struct
s when some condition is met?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以根据需要多次调用
kthread_create
来创建新线程,然后对所需的任何线程子集调用wake_up
。You can call
kthread_create
as many times as you want to create new threads, and then callwake_up
on whatever subset of threads you want.