Prev: where is good sample code I can learn about linux system programming
Next: How to get IP address from C application
From: Ersek, Laszlo on 20 May 2010 11:00 On Thu, 20 May 2010, miloody wrote: > Would someone tell me where I can find somw excellent examples which > shows me how to write system programs under linux, something like IPC, > MMap, thread and signal, etc. > I read some document about them and some simple program to show how to > use them. > But what I really want is to trace a program which combine the usages of > all of them gracefully. If you want a program that combines *all* of them, then you're probably looking for a performance-oriented networked server that works with regular files (eg. FTP server, web server, torrent client etc, but anything in HPC, or wherever high throughput is important, might play). I reckon such software wouldn't be the best choice for educational purposes. Buy the Stevens books. http://kohala.com/start/ One piece of art that combines (at least) mmap() with IPC is rtorrent. I believe it read()'s from sockets directly into mmap()'d regions. Prepare for a bumpy ride if you decide to read its source; rtorrent is production software. http://libtorrent.rakshasa.no/ Unfortunately for you, the contributors of this group who could help you most presumably dedicate most of their time to their own proprietary developments. Based on what I've read here up till now, I'm convinced those products are excellent. You just can't peek at their source codes :) --o-- Independently, since I saw promotion of proprietary products happen here (which I don't have a problem with -- I mention this only as my education in netiquette), I'll turn a blind eye on the adjective "excellent" in your post and dare to name these -- they might help you if you find nothing else: lbzip2 - threads and signals udp_copy2 - UDP/IPv4 and signals forward3 - TCP/IPv4 and signals, daemonizing, timeouts These are ridiculous from a performance-tuning point of view, but I strived hard to make them correct, portable, and reasonably documented. They are short and get stuff done (at least for me). All under the GPLv2+. .... Actually, the "connection setup" parts suck from the future-proofness POV; you should learn APIs that are IPv[46]-agnostic. See: http://people.redhat.com/drepper/userapi-ipv6.html (I'll start to fiddle with IPv6 once my residential ISP or my work environment starts to offer (or demand) IPv6.) Cheers, lacos http://lacos.hu/ |