Skynet is a server framework based on the actor model implemented by the cloud wind, with core 7,000 + lines of C code and a LUA binding. Write more concise, use more readily, very close to my appetite, combined with the decision in the company's recent project on the Skynet, so decided to read through the source code, will think of the results recorded in this, so that the use of conscience.
The implementation of Skynet is based on several actor behaviors:
- Can create and destroy other actor,actor as a lateral relationship.
- can send messages to other actors and receive messages from other actors.
- Interaction between actors can only be passed through the message.
- Able to handle their own messages.
In the Skynet world, the actor is represented by a dynamic library, and each so is given an ID that never repeats ([1,4g]) as the identity, so must register a callback function with the framework to process the message. The framework does only two things:
- The message sent is correctly delivered to the target actor.
- A balanced, fast call to So's callback handles the message, which is not concurrent and only processes one message at a time.
Not to be continued, there are inappropriate, please friends to correct me.
Skynet Source Analysis 1: Opening Ming Yi