kqueue

Are there in AIX mechanisms EPOLL/KQUEUE or their equivalents?

[亡魂溺海] 提交于 2021-01-28 00:34:55
问题 Are there in AIX mechanisms EPOLL(Linux2.6)/KQUEUE(FreeBSD)/IO Completion Port(Windows) or their equivalents? And what kind of mechanisms are optimal for AIO on AIX for a large number of network connections? For example according to the Benchmarks, the mechanisms KQUEUE / EPOLL much faster than SELECT. http://libevent.org/ 回答1: I believe poll set is the best choice today. There is also the iocp interfaces which comes from windows. And there are the aio interfaces which use iocp under the

How do I replace select() with kevent() for higher performance?

强颜欢笑 提交于 2020-01-03 09:10:15
问题 From the Kqueue Wikipedia Page: Kqueue provides efficient input and output event pipelines between the kernel and userland. Thus, it is possible to modify event filters as well as receive pending events while using only a single system call to kevent(2) per main event loop iteration. This contrasts with older traditional polling system calls such as poll(2) and select(2) which are less efficient, especially when polling for events on a large number of file descriptors That sounds great. I

kqueue() and O_NONBLOCK

我们两清 提交于 2020-01-02 09:42:31
问题 If you use kqueue(), should you set O_NONBLOCK on your file descriptors? In other words, does kqueue() guarantee that the next I/O operation on a ready file descriptor will not block, regardless of whether O_NONBLOCK is set? 回答1: If you use kqueue(), should you set O_NONBLOCK on your file descriptors? Nope. In other words, does kqueue() guarantee that the next I/O operation on a ready file descriptor will not block, regardless of whether O_NONBLOCK is set? Yep. 回答2: You do not need to.

Check if file is modified deleted or extended using python select.kqueue()

有些话、适合烂在心里 提交于 2019-12-25 02:14:27
问题 Hi I am having a hard time understanding how to use the BSD only python module classes select.kqueue and select.kevent to setup a watch for file write events. I want to a python program to respond whenever a text file is written to by another process. My test code goes as follows: import os myfd = os.open("/Users/hari/c2cbio/t.txt",os.O_RDONLY) my_event=select.kevent(myfd,filter=select.KQ_FILTER_VNODE,fflags=select.KQ_NOTE_WRITE|select.KQ_NOTE_EXTEND) # I now create a kqueue object and a

Where to declare sig_t signal for SIGPIPE

跟風遠走 提交于 2019-12-23 13:07:27
问题 I'm currently using a kqueue to handle multiple Clients per Thread in a Serverprocess so I don't want the thread to be terminated when the Signal SIGPIPE appears, i would just like to remove the according socked id from the kqueue. So My question is: Is there a way to get the according socketid inside a Signalhandle and parse it back to the Process to remove it from the event kqueue or would i have jsut to SIG_IGN the SIGPIPE and handle the remove by returning of -1 from send? and would it

revisiting “how do you use aio and epoll together”

不羁的心 提交于 2019-12-20 12:27:08
问题 following the discussion at How do you use AIO and epoll together in a single event loop?. There are in fact 2 "aio" APIs in linux. There's POSIX aio (the aio_* family of functions), included in glibc and libaio developed I believe by RedHat (?), the io_* family. The first one allows registration of notification requests via aio_sigevent aiocb member. That can be easily integrated with ppoll()/pselect() event loops. If you want to integrate POSIX aio with epoll() then you need to translate

File system watching in iOS

江枫思渺然 提交于 2019-12-11 18:18:57
问题 I have file tree in my Documents folder. What is the easiest way to watch all changes in Documents folder and in all its subfolders? I've already read about kqueue but it seems that it works only for folder itself(not for its subfolders). 回答1: The cost of scanning the file system is relatively high if you can't do it using a function built into the OS. For iOS, your app file system can't really change while the app is running. iTunes can sync some file which may be an issue for you but

why epoll accepted new fd and spawn new thread doesn't scale well?

倾然丶 夕夏残阳落幕 提交于 2019-12-11 14:33:41
问题 I have seen a lot of argument about epoll accepted new fd and spawn new thread for read and write on it's own thread doesn't scale well? But how it doesn't scale well? What if every connection has heavy processing like:- doing database transaction doing heavy algorithm work waiting for other things to completed. If my purpose definitely just want to do the thing inside the program( no more fancy routing to other connection to do stuff ), and do not spawn new thread for read/write io. It might

Reading updated files on the fly in Python

孤人 提交于 2019-12-11 01:34:46
问题 I'm writing two Python scripts that both parse files. One is a standard unix logfile and the other is a binary file. I'm trying to figure out the best way to monitor these so I can read data as soon as they're updated. Most of the solutions I've found thus far are linux specific, but I need this to work in FreeBSD. Obviously one approach would be to just run my script every X amount of time, but this seems gross and inefficient. If I want my Python app running continuously in the background

Difference in kqueue handling of fifos between Mac OS and FreeBSD?

时光怂恿深爱的人放手 提交于 2019-12-07 13:08:12
问题 I'm working on an application that uses fifos for IPC and uses an event-notification API (such as epoll or kqueue) to monitor the fifos for data to be read. The application expects that if the writer for a fifo terminates that the reader will receive an event via the event notification API, allowing the reader to notice that the writer terminated. I'm currently porting this application to macos and I'm running into some odd behavior with kqueue. I've been able to create a reproducer of this