Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between event-driven and asynchronous? Between epoll and AIO?

Event-driven and asynchronous are often used as synonyms. Are there any differences between the two?

Also, what is the difference between epoll and aio? How do they fit together?

Lastly, I've read many times that AIO in Linux is horribly broken. How exactly is it broken?

Thanks.

like image 463
Continuation Avatar asked Apr 30 '11 22:04

Continuation


People also ask

What is asynchronous and event driven?

Asynchronous is basically multitasking. It can spawn off multiple threads or processes to execute a certain function. It's totally different from event driven in the sense that each thread is independent and hardly interact with the main thread in an easy responsive manner.

Is event driven architecture async?

Event-driven architecture is often referred to as “asynchronous” communication. This means that the sender and recipient don't have to wait for each other to move onto their next task. Systems are not dependent on that one message.

What is the difference between a synchronous event and asynchronous event give example?

An excellent synchronous example is music. Each participating instrument needs to be in rhythm with the others or else the music won't sound right. For asynchronous, a good example would be traffic. Vehicles move at different rates of speed and it is common for one to move past another.

What is asynchronous event?

In general, asynchronous -- pronounced ay-SIHN-kro-nuhs, from Greek asyn-, meaning "not with," and chronos, meaning "time" -- is an adjective describing objects or events that are not coordinated in time.


1 Answers

Events is one of the paradigms to achieve asynchronous execution. But not all asynchronous systems use events. That is about semantic meaning of these two - one is super-entity of another.

epoll and aio use different metaphors:

epoll is a blocking operation (epoll_wait()) - you block the thread until some event happens and then you dispatch the event to different procedures/functions/branches in your code.

In AIO, you pass the address of your callback function (completion routine) to the system and the system calls your function when something happens.

Problem with AIO is that your callback function code runs on the system thread and so on top of the system stack. A few problems with that as you can imagine.

like image 130
c-smile Avatar answered Sep 19 '22 22:09

c-smile