Skip to content

Asynchronous IO + coroutine, a high performance solution for networking server. You can write code as synchronous model, rather than control state machine by yourself.

Notifications You must be signed in to change notification settings

machicao2013/async_coro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction
------------
This library try to encapsulate new APIs so that you can create coroutines as pthread, write readable/intelligible code, easy to port old pthread related code to thread-less application, and what's more important: high performance.

This library provides coroutine management and a series of IO functions to make you write code easily, context will be switched while executing these slow IO functions. Refer to examples for more informations.

Background
----------
In synchronous programming model, we can create a new thread to handle a new request, the running thread will be blocked when it's processing some slow calls(such as read(2), write(2)), the overhead is unacceptable if we have thousands of connections because OS have to schedule them and the context switches are pretty expensive.

An alternative way of handling such huge number of connections in Linux/FreeBSD is to use epoll(2)/kqueue(2), or libevent/libev for portable application, however, even these third library encapsulated interfaces and easy to use, it's still harder than synchronous IO, you have to control the state machine and switch by yourself, e.g.: it's not a comfortable thing when you have to parse some complex networking protocol.

About

Asynchronous IO + coroutine, a high performance solution for networking server. You can write code as synchronous model, rather than control state machine by yourself.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published