Sharing heap memory with fork()

前端 未结 5 1163
半阙折子戏
半阙折子戏 2021-02-15 11:53

I am working on implementing a database server in C that will handle requests from multiple clients. In order to do so I am using fork() to handle connections for individual cli

5条回答
  •  礼貌的吻别
    2021-02-15 12:43

    If you must you fork, the shared memory seems to be the 'only' choice.

    Actually, I think in your scene, the thread is more suitable.

    If you don't want to be multi-threaded. Here is another choice,you can only use one-process & one-thread mode, like redis

    With this mode,you don't need worry about something like lock and if you want to scale, just design a route policy,as route with the hash value of the key

提交回复
热议问题