选勇's profile诗、剑、酒、梅花PhotosBlogLists Tools Help

Blog


    July 26

    The C10K problem ( part 2 )

     

    Comments

    Richard Gooch has written a paper discussing I/O options.

    In 2001, Tim Brecht and MMichal Ostrowski measured various strategies for simple select-based servers. Their data is worth a look.

    In 2003, Tim Brecht posted source code for userver, a small web server put together from several servers written by Abhishek Chandra, David Mosberger, David Pariag, and Michal Ostrowski. It can use select(), poll(), epoll(), or sigio.

    Back in March 1999, Dean Gaudet posted:

    I keep getting asked "why don't you guys use a select/event based model like Zeus? It's clearly the fastest." ...
    His reasons boiled down to "it's really hard, and the payoff isn't clear". Within a few months, though, it became clear that people were willing to work on it.

    Mark Russinovich wrote an editorial and an article discussing I/O strategy issues in the 2.2 Linux kernel. Worth reading, even he seems misinformed on some points. In particular, he seems to think that Linux 2.2's asynchronous I/O (see F_SETSIG above) doesn't notify the user process when data is ready, only when new connections arrive. This seems like a bizarre misunderstanding. See also comments on an earlier draft, Ingo Molnar's rebuttal of 30 April 1999, Russinovich's comments of 2 May 1999, a rebuttal from Alan Cox, and various posts to linux-kernel. I suspect he was trying to say that Linux doesn't support asynchronous disk I/O, which used to be true, but now that SGI has implemented KAIO, it's not so true anymore.

    See these pages at sysinternals.com and MSDN for information on "completion ports", which he said were unique to NT; in a nutshell, win32's "overlapped I/O" turned out to be too low level to be convenient, and a "completion port" is a wrapper that provides a queue of completion events, plus scheduling magic that tries to keep the number of running threads constant by allowing more threads to pick up completion events if other threads that had picked up completion events from this port are sleeping (perhaps doing blocking I/O).

    See also OS/400's support for I/O completion ports.

    There was an interesting discussion on linux-kernel in September 1999 titled "> 15,000 Simultaneous Connections" (and the second week of the thread). Highlights:

    • Ed Hall posted a few notes on his experiences; he's achieved >1000 connects/second on a UP P2/333 running Solaris. His code used a small pool of threads (1 or 2 per CPU) each managing a large number of clients using "an event-based model".
    • Mike Jagdis posted an analysis of poll/select overhead, and said "The current select/poll implementation can be improved significantly, especially in the blocking case, but the overhead will still increase with the number of descriptors because select/poll does not, and cannot, remember what descriptors are interesting. This would be easy to fix with a new API. Suggestions are welcome..."
    • Mike posted about his work on improving select() and poll().
    • Mike posted a bit about a possible API to replace poll()/select(): "How about a 'device like' API where you write 'pollfd like' structs, the 'device' listens for events and delivers 'pollfd like' structs representing them when you read it? ... "
    • Rogier Wolff suggested using "the API that the digital guys suggested", http://www.cs.rice.edu/~gaurav/papers/usenix99.ps
    • Joerg Pommnitz pointed out that any new API along these lines should be able to wait for not just file descriptor events, but also signals and maybe SYSV-IPC. Our synchronization primitives should certainly be able to do what Win32's WaitForMultipleObjects can, at least.
    • Stephen Tweedie asserted that the combination of F_SETSIG, queued realtime signals, and sigwaitinfo() was a superset of the API proposed in http://www.cs.rice.edu/~gaurav/papers/usenix99.ps. He also mentions that you keep the signal blocked at all times if you're interested in performance; instead of the signal being delivered asynchronously, the process grabs the next one from the queue with sigwaitinfo().
    • Jayson Nordwick compared completion ports with the F_SETSIG synchronous event model, and concluded they're pretty similar.
    • Alan Cox noted that an older rev of SCT's SIGIO patch is included in 2.3.18ac.
    • Jordan Mendelson posted some example code showing how to use F_SETSIG.
    • Stephen C. Tweedie continued the comparison of completion ports and F_SETSIG, and noted: "With a signal dequeuing mechanism, your application is going to get signals destined for various library components if libraries are using the same mechanism," but the library can set up its own signal handler, so this shouldn't affect the program (much).
    • Doug Royer noted that he'd gotten 100,000 connections on Solaris 2.6 while he was working on the Sun calendar server. Others chimed in with estimates of how much RAM that would require on Linux, and what bottlenecks would be hit.

    Interesting reading!

    Limits on open filehandles

    • Any Unix: the limits set by ulimit or setrlimit.
    • Solaris: see the Solaris FAQ, question 3.46 (or thereabouts; they renumber the questions periodically).
    • FreeBSD:

      Edit /boot/loader.conf, add the line
      set kern.maxfiles=XXXX
      where XXXX is the desired system limit on file descriptors, and reboot. Thanks to an anonymous reader, who wrote in to say he'd achieved far more than 10000 connections on FreeBSD 4.3, and says
      "FWIW: You can't actually tune the maximum number of connections in FreeBSD trivially, via sysctl.... You have to do it in the /boot/loader.conf file.
      The reason for this is that the zalloci() calls for initializing the sockets and tcpcb structures zones occurs very early in system startup, in order that the zone be both type stable and that it be swappable.
      You will also need to set the number of mbufs much higher, since you will (on an unmodified kernel) chew up one mbuf per connection for tcptempl structures, which are used to implement keepalive."
      Another reader says
      "As of FreeBSD 4.4, the tcptempl structure is no longer allocated; you no longer have to worry about one mbuf being chewed up per connection."
      See also:
    • OpenBSD: A reader says
      "In OpenBSD, an additional tweak is required to increase the number of open filehandles available per process: the openfiles-cur parameter in /etc/login.conf needs to be increased. You can change kern.maxfiles either with sysctl -w or in sysctl.conf but it has no effect. This matters because as shipped, the login.conf limits are a quite low 64 for nonprivileged processes, 128 for privileged."
    • Linux: See Bodo Bauer's /proc documentation. On 2.4 kernels:
      echo 32768 > /proc/sys/fs/file-max
      
      increases the system limit on open files, and
      ulimit -n 32768
      increases the current process' limit.

      On 2.2.x kernels,

      echo 32768 > /proc/sys/fs/file-max
      echo 65536 > /proc/sys/fs/inode-max
      
      increases the system limit on open files, and
      ulimit -n 32768
      increases the current process' limit.

      I verified that a process on Red Hat 6.0 (2.2.5 or so plus patches) can open at least 31000 file descriptors this way. Another fellow has verified that a process on 2.2.12 can open at least 90000 file descriptors this way (with appropriate limits). The upper bound seems to be available memory.
      Stephen C. Tweedie posted about how to set ulimit limits globally or per-user at boot time using initscript and pam_limit.
      In older 2.2 kernels, though, the number of open files per process is still limited to 1024, even with the above changes.
      See also Oskar's 1998 post, which talks about the per-process and system-wide limits on file descriptors in the 2.0.36 kernel.

    Limits on threads

    On any architecture, you may need to reduce the amount of stack space allocated for each thread to avoid running out of virtual memory. You can set this at runtime with pthread_attr_init() if you're using pthreads.

    • Solaris: it supports as many threads as will fit in memory, I hear.
    • Linux 2.6 kernels with NPTL: /proc/sys/vm/max_map_count may need to be increased to go above 32000 or so threads. (You'll need to use very small stack threads to get anywhere near that number of threads, though, unless you're on a 64 bit processor.) See the NPTL mailing list, e.g. the thread with subject "Cannot create more than 32K threads?", for more info.
    • Linux 2.4: /proc/sys/kernel/threads-max is the max number of threads; it defaults to 2047 on my Red Hat 8 system. You can set increase this as usual by echoing new values into that file, e.g. "echo 4000 > /proc/sys/kernel/threads-max"
    • Linux 2.2: Even the 2.2.13 kernel limits the number of threads, at least on Intel. I don't know what the limits are on other architectures. Mingo posted a patch for 2.1.131 on Intel that removed this limit. It appears to be integrated into 2.3.20.

      See also Volano's detailed instructions for raising file, thread, and FD_SET limits in the 2.2 kernel. Wow. This document steps you through a lot of stuff that would be hard to figure out yourself, but is somewhat dated.

    • Java: See Volano's detailed benchmark info, plus their info on how to tune various systems to handle lots of threads.

    Java issues

    Up through JDK 1.3, Java's standard networking libraries mostly offered the one-thread-per-client model. There was a way to do nonblocking reads, but no way to do nonblocking writes.

    In May 2001, JDK 1.4 introduced the package java.nio to provide full support for nonblocking I/O (and some other goodies). See the release notes for some caveats. Try it out and give Sun feedback!

    HP's java also includes a Thread Polling API.

    In 2000, Matt Welsh implemented nonblocking sockets for Java; his performance benchmarks show that they have advantages over blocking sockets in servers handling many (up to 10000) connections. His class library is called java-nbio; it's part of the Sandstorm project. Benchmarks showing performance with 10000 connections are available.

    See also Dean Gaudet's essay on the subject of Java, network I/O, and threads, and the paper by Matt Welsh on events vs. worker threads.

    Before NIO, there were several proposals for improving Java's networking APIs:

    • Matt Welsh's Jaguar system proposes preserialized objects, new Java bytecodes, and memory management changes to allow the use of asynchronous I/O with Java.
    • Interfacing Java to the Virtual Interface Architecture, by C-C. Chang and T. von Eicken, proposes memory management changes to allow the use of asynchronous I/O with Java.
    • JSR-51 was the Sun project that came up with the java.nio package. Matt Welsh participated (who says Sun doesn't listen?).

    Other tips

    • Zero-Copy
      Normally, data gets copied many times on its way from here to there. Any scheme that eliminates these copies to the bare physical minimum is called "zero-copy".
      • Thomas Ogrisegg's zero-copy send patch for mmaped files under Linux 2.4.17-2.4.20. Claims it's faster than sendfile().
      • IO-Lite is a proposal for a set of I/O primitives that gets rid of the need for many copies.
      • Alan Cox noted that zero-copy is sometimes not worth the trouble back in 1999. (He did like sendfile(), though.)
      • Ingo implemented a form of zero-copy TCP in the 2.4 kernel for TUX 1.0 in July 2000, and says he'll make it available to userspace soon.
      • Drew Gallatin and Robert Picco have added some zero-copy features to FreeBSD; the idea seems to be that if you call write() or read() on a socket, the pointer is page-aligned, and the amount of data transferred is at least a page, *and* you don't immediately reuse the buffer, memory management tricks will be used to avoid copies. But see followups to this message on linux-kernel for people's misgivings about the speed of those memory management tricks.

        According to a note from Noriyuki Soda:

        Sending side zero-copy is supported since NetBSD-1.6 release by specifying "SOSEND_LOAN" kernel option. This option is now default on NetBSD-current (you can disable this feature by specifying "SOSEND_NO_LOAN" in the kernel option on NetBSD_current). With this feature, zero-copy is automatically enabled, if data more than 4096 bytes are specified as data to be sent.
      • The sendfile() system call can implement zero-copy networking.
        The sendfile() function in Linux and FreeBSD lets you tell the kernel to send part or all of a file. This lets the OS do it as efficiently as possible. It can be used equally well in servers using threads or servers using nonblocking I/O. (In Linux, it's poorly documented at the moment; use _syscall4 to call it. Andi Kleen is writing new man pages that cover this. See also Exploring The sendfile System Call by Jeff Tranter in Linux Gazette issue 91.) Rumor has it, ftp.cdrom.com benefitted noticeably from sendfile().

        A zero-copy implementation of sendfile() is on its way for the 2.4 kernel. See LWN Jan 25 2001.

        One developer using sendfile() with Freebsd reports that using POLLWRBAND instead of POLLOUT makes a big difference.

        Solaris 8 (as of the July 2001 update) has a new system call 'sendfilev'. A copy of the man page is here.. The Solaris 8 7/01 release notes also mention it. I suspect that this will be most useful when sending to a socket in blocking mode; it'd be a bit of a pain to use with a nonblocking socket.

    • Avoid small frames by using writev (or TCP_CORK)
      A new socket option under Linux, TCP_CORK, tells the kernel to avoid sending partial frames, which helps a bit e.g. when there are lots of little write() calls you can't bundle together for some reason. Unsetting the option flushes the buffer. Better to use writev(), though...

      See LWN Jan 25 2001 for a summary of some very interesting discussions on linux-kernel about TCP_CORK and a possible alternative MSG_MORE.

    • Behave sensibly on overload.
      [Provos, Lever, and Tweedie 2000] notes that dropping incoming connections when the server is overloaded improved the shape of the performance curve, and reduced the overall error rate. They used a smoothed version of "number of clients with I/O ready" as a measure of overload. This technique should be easily applicable to servers written with select, poll, or any system call that returns a count of readiness events per call (e.g. /dev/poll or sigtimedwait4()).
    • Some programs can benefit from using non-Posix threads.
      Not all threads are created equal. The clone() function in Linux (and its friends in other operating systems) lets you create a thread that has its own current working directory, for instance, which can be very helpful when implementing an ftp server. See Hoser FTPd for an example of the use of native threads rather than pthreads.
    • Caching your own data can sometimes be a win.
      "Re: fix for hybrid server problems" by Vivek Sadananda Pai (vivek@cs.rice.edu) on new-httpd, May 9th, states:

      "I've compared the raw performance of a select-based server with a multiple-process server on both FreeBSD and Solaris/x86. On microbenchmarks, there's only a marginal difference in performance stemming from the software architecture. The big performance win for select-based servers stems from doing application-level caching. While multiple-process servers can do it at a higher cost, it's harder to get the same benefits on real workloads (vs microbenchmarks). I'll be presenting those measurements as part of a paper that'll appear at the next Usenix conference. If you've got postscript, the paper is available at http://www.cs.rice.edu/~vivek/flash99/"

    Other limits

    • Old system libraries might use 16 bit variables to hold file handles, which causes trouble above 32767 handles. glibc2.1 should be ok.
    • Many systems use 16 bit variables to hold process or thread id's. It would be interesting to port the Volano scalability benchmark to C, and see what the upper limit on number of threads is for the various operating systems.
    • Too much thread-local memory is preallocated by some operating systems; if each thread gets 1MB, and total VM space is 2GB, that creates an upper limit of 2000 threads.
    • Look at the performance comparison graph at the bottom of http://www.acme.com/software/thttpd/benchmarks.html. Notice how various servers have trouble above 128 connections, even on Solaris 2.6? Anyone who figures out why, let me know.
      Note: if the TCP stack has a bug that causes a short (200ms) delay at SYN or FIN time, as Linux 2.2.0-2.2.6 had, and the OS or http daemon has a hard limit on the number of connections open, you would expect exactly this behavior. There may be other causes.

    Kernel Issues

    For Linux, it looks like kernel bottlenecks are being fixed constantly. See Linux Weekly News, Kernel Traffic, the Linux-Kernel mailing list, and my Mindcraft Redux page.

    In March 1999, Microsoft sponsored a benchmark comparing NT to Linux at serving large numbers of http and smb clients, in which they failed to see good results from Linux. See also my article on Mindcraft's April 1999 Benchmarks for more info.

    See also The Linux Scalability Project. They're doing interesting work, including Niels Provos' hinting poll patch, and some work on the thundering herd problem.

    See also Mike Jagdis' work on improving select() and poll(); here's Mike's post about it.

    Mohit Aron (aron@cs.rice.edu) writes that rate-based clocking in TCP can improve HTTP response time over 'slow' connections by 80%.

    Measuring Server Performance

    Two tests in particular are simple, interesting, and hard:

    1. raw connections per second (how many 512 byte files per second can you serve?)
    2. total transfer rate on large files with many slow clients (how many 28.8k modem clients can simultaneously download from your server before performance goes to pot?)

    Jef Poskanzer has published benchmarks comparing many web servers. See http://www.acme.com/software/thttpd/benchmarks.html for his results.

    I also have a few old notes about comparing thttpd to Apache that may be of interest to beginners.

    Chuck Lever keeps reminding us about Banga and Druschel's paper on web server benchmarking. It's worth a read.

    IBM has an excellent paper titled Java server benchmarks [Baylor et al, 2000]. It's worth a read.

    Examples

    Interesting select()-based servers

    Interesting /dev/poll-based servers

    • N. Provos, C. Lever, "Scalable Network I/O in Linux," May, 2000. [FREENIX track, Proc. USENIX 2000, San Diego, California (June, 2000).] Describes a version of thttpd modified to support /dev/poll. Performance is compared with phhttpd.

    Interesting kqueue()-based servers

    Interesting realtime signal-based servers

    • Chromium's X15. This uses the 2.4 kernel's SIGIO feature together with sendfile() and TCP_CORK, and reportedly achieves higher speed than even TUX. The source is available under a community source (not open source) license. See the original announcement by Fabio Riccardi.
    • Zach Brown's phhttpd - "a quick web server that was written to showcase the sigio/siginfo event model. consider this code highly experimental and yourself highly mental if you try and use it in a production environment." Uses the siginfo features of 2.3.21 or later, and includes the needed patches for earlier kernels. Rumored to be even faster than khttpd. See his post of 31 May 1999 for some notes.

    Interesting thread-based servers

    Interesting in-kernel servers

    Other interesting links


    Changelog

    $Log: c10k.html,v $
    Revision 1.212  2006/09/02 14:52:13  dank
    added asio
    
    Revision 1.211  2006/07/27 10:28:58  dank
    Link to Cal Henderson's book.
    
    Revision 1.210  2006/07/27 10:18:58  dank
    Listify polyakov links, add Drepper's new proposal, note that FreeBSD 7 might move to 1:1
    
    Revision 1.209  2006/07/13 15:07:03  dank
    link to Scale! library, updated Polyakov links
    
    Revision 1.208  2006/07/13 14:50:29  dank
    Link to Polyakov's patches
    
    Revision 1.207  2003/11/03 08:09:39  dank
    Link to Linus's message deprecating the idea of aio_open
    
    Revision 1.206  2003/11/03 07:44:34  dank
    link to userver
    
    Revision 1.205  2003/11/03 06:55:26  dank
    Link to Vivek Pei's new Flash paper, mention great specweb99 score
    
    

    Copyright 1999-2006 Dan Kegel
    dank@kegel.com
    Last updated: 2 Sept 2006
    [Return to www.kegel.com]  

    The C10K problem ( part 1 )

    [copy from : http://www.kegel.com/c10k.html]

    It's time for web servers to handle ten thousand clients simultaneously, don't you think? After all, the web is a big place now.

    And computers are big, too. You can buy a 1000MHz machine with 2 gigabytes of RAM and an 1000Mbit/sec Ethernet card for $1200 or so. Let's see - at 20000 clients, that's 50KHz, 100Kbytes, and 50Kbits/sec per client. It shouldn't take any more horsepower than that to take four kilobytes from the disk and send them to the network once a second for each of twenty thousand clients. (That works out to $0.08 per client, by the way. Those $100/client licensing fees some operating systems charge are starting to look a little heavy!) So hardware is no longer the bottleneck.

    In 1999 one of the busiest ftp sites, cdrom.com, actually handled 10000 clients simultaneously through a Gigabit Ethernet pipe. As of 2001, that same speed is now being offered by several ISPs, who expect it to become increasingly popular with large business customers.

    And the thin client model of computing appears to be coming back in style -- this time with the server out on the Internet, serving thousands of clients.

    With that in mind, here are a few notes on how to configure operating systems and write code to support thousands of clients. The discussion centers around Unix-like operating systems, as that's my personal area of interest, but Windows is also covered a bit.

    Contents

    Related Sites

    In October 2003, Felix von Leitner put together an excellent web page and presentation about network scalability, complete with benchmarks comparing various networking system calls and operating systems. One of his observations is that the 2.6 Linux kernel really does beat the 2.4 kernel, but there are many, many good graphs that will give the OS developers food for thought for some time. (See also the Slashdot comments; it'll be interesting to see whether anyone does followup benchmarks improving on Felix's results.)

    Book to Read First

    If you haven't read it already, go out and get a copy of Unix Network Programming : Networking Apis: Sockets and Xti (Volume 1) by the late W. Richard Stevens. It describes many of the I/O strategies and pitfalls related to writing high-performance servers. It even talks about the 'thundering herd' problem. And while you're at it, go read Jeff Darcy's notes on high-performance server design.

    (Another book which might be more helpful for those who are *using* rather than *writing* a web server is Building Scalable Web Sites by Cal Henderson.)

    I/O frameworks

    Prepackaged libraries are available that abstract some of the techniques presented below, insulating your code from the operating system and making it more portable.

    • ACE, a heavyweight C++ I/O framework, contains object-oriented implementations of some of these I/O strategies and many other useful things. In particular, his Reactor is an OO way of doing nonblocking I/O, and Proactor is an OO way of doing asynchronous I/O.
    • ASIO is an C++ I/O framework which is becoming part of the Boost library. It's like ACE updated for the STL era.
    • libevent is a lightweight C I/O framework by Niels Provos. It supports kqueue and select, and soon will support poll and epoll. It's level-triggered only, I think, which has both good and bad sides. Niels has a nice graph of time to handle one event as a function of the number of connections. It shows kqueue and sys_epoll as clear winners.
    • My own attempts at lightweight frameworks (sadly, not kept up to date):
      • Poller is a lightweight C++ I/O framework that implements a level-triggered readiness API using whatever underlying readiness API you want (poll, select, /dev/poll, kqueue, or sigio). It's useful for benchmarks that compare the performance of the various APIs. This document links to Poller subclasses below to illustrate how each of the readiness APIs can be used.
      • rn is a lightweight C I/O framework that was my second try after Poller. It's lgpl (so it's easier to use in commercial apps) and C (so it's easier to use in non-C++ apps). It was used in some commercial products.
    • Matt Welsh wrote a paper in April 2000 about how to balance the use of worker thread and event-driven techniques when building scalable servers. The paper describes part of his Sandstorm I/O framework.
    • Cory Nelson's Scale! library - an async socket, file, and pipe I/O library for Windows

    I/O Strategies

    Designers of networking software have many options. Here are a few:
    • Whether and how to issue multiple I/O calls from a single thread
      • Don't; use blocking/synchronous calls throughout, and possibly use multiple threads or processes to achieve concurrency
      • Use nonblocking calls (e.g. write() on a socket set to O_NONBLOCK) to start I/O, and readiness notification (e.g. poll() or /dev/poll) to know when it's OK to start the next I/O on that channel. Generally only usable with network I/O, not disk I/O.
      • Use asynchronous calls (e.g. aio_write()) to start I/O, and completion notification (e.g. signals or completion ports) to know when the I/O finishes. Good for both network and disk I/O.
    • How to control the code servicing each client
      • one process for each client (classic Unix approach, used since 1980 or so)
      • one OS-level thread handles many clients; each client is controlled by:
        • a user-level thread (e.g. GNU state threads, classic Java with green threads)
        • a state machine (a bit esoteric, but popular in some circles; my favorite)
        • a continuation (a bit esoteric, but popular in some circles)
      • one OS-level thread for each client (e.g. classic Java with native threads)
      • one OS-level thread for each active client (e.g. Tomcat with apache front end; NT completion ports; thread pools)
    • Whether to use standard O/S services, or put some code into the kernel (e.g. in a custom driver, kernel module, or VxD)

    The following five combinations seem to be popular:

    1. Serve many clients with each thread, and use nonblocking I/O and level-triggered readiness notification
    2. Serve many clients with each thread, and use nonblocking I/O and readiness change notification
    3. Serve many clients with each server thread, and use asynchronous I/O
    4. serve one client with each server thread, and use blocking I/O
    5. Build the server code into the kernel

    1. Serve many clients with each thread, and use nonblocking I/O and level-triggered readiness notification

    ... set nonblocking mode on all network handles, and use select() or poll() to tell which network handle has data waiting. This is the traditional favorite. With this scheme, the kernel tells you whether a file descriptor is ready, whether or not you've done anything with that file descriptor since the last time the kernel told you about it. (The name 'level triggered' comes from computer hardware design; it's the opposite of 'edge triggered'. Jonathon Lemon introduced the terms in his BSDCON 2000 paper on kqueue().)

    Note: it's particularly important to remember that readiness notification from the kernel is only a hint; the file descriptor might not be ready anymore when you try to read from it. That's why it's important to use nonblocking mode when using readiness notification.

    An important bottleneck in this method is that read() or sendfile() from disk blocks if the page is not in core at the moment; setting nonblocking mode on a disk file handle has no effect. Same thing goes for memory-mapped disk files. The first time a server needs disk I/O, its process blocks, all clients must wait, and that raw nonthreaded performance goes to waste.
    This is what asynchronous I/O is for, but on systems that lack AIO, worker threads or processes that do the disk I/O can also get around this bottleneck. One approach is to use memory-mapped files, and if mincore() indicates I/O is needed, ask a worker to do the I/O, and continue handling network traffic. Jef Poskanzer mentions that Pai, Druschel, and Zwaenepoel's 1999 Flash web server uses this trick; they gave a talk at Usenix '99 on it. It looks like mincore() is available in BSD-derived Unixes like FreeBSD and Solaris, but is not part of the Single Unix Specification. It's available as part of Linux as of kernel 2.3.51, thanks to Chuck Lever.

    But in November 2003 on the freebsd-hackers list, Vivek Pei et al reported very good results using system-wide profiling of their Flash web server to attack bottlenecks. One bottleneck they found was mincore (guess that wasn't such a good idea after all) Another was the fact that sendfile blocks on disk access; they improved performance by introducing a modified sendfile() that return something like EWOULDBLOCK when the disk page it's fetching is not yet in core. (Not sure how you tell the user the page is now resident... seems to me what's really needed here is aio_sendfile().) The end result of their optimizations is a SpecWeb99 score of about 800 on a 1GHZ/1GB FreeBSD box, which is better than anything on file at spec.org.

    There are several ways for a single thread to tell which of a set of nonblocking sockets are ready for I/O:

    • The traditional select()
      Unfortunately, select() is limited to FD_SETSIZE handles. This limit is compiled in to the standard library and user programs. (Some versions of the C library let you raise this limit at user app compile time.)

      See Poller_select (cc, h) for an example of how to use select() interchangeably with other readiness notification schemes.

    • The traditional poll()
      There is no hardcoded limit to the number of file descriptors poll() can handle, but it does get slow about a few thousand, since most of the file descriptors are idle at any one time, and scanning through thousands of file descriptors takes time.

      Some OS's (e.g. Solaris 8) speed up poll() et al by use of techniques like poll hinting, which was implemented and benchmarked by Niels Provos for Linux in 1999.

      See Poller_poll (cc, h, benchmarks) for an example of how to use poll() interchangeably with other readiness notification schemes.

    • /dev/poll
      This is the recommended poll replacement for Solaris.

      The idea behind /dev/poll is to take advantage of the fact that often poll() is called many times with the same arguments. With /dev/poll, you get an open handle to /dev/poll, and tell the OS just once what files you're interested in by writing to that handle; from then on, you just read the set of currently ready file descriptors from that handle.

      It appeared quietly in Solaris 7 (see patchid 106541) but its first public appearance was in Solaris 8; according to Sun, at 750 clients, this has 10% of the overhead of poll().

      Various implementations of /dev/poll were tried on Linux, but none of them perform as well as epoll, and were never really completed. /dev/poll use on Linux is not recommended.

      See Poller_devpoll (cc, h benchmarks ) for an example of how to use /dev/poll interchangeably with many other readiness notification schemes. (Caution - the example is for Linux /dev/poll, might not work right on Solaris.)

    • kqueue()
      This is the recommended poll replacement for FreeBSD (and, soon, NetBSD).

      See below. kqueue() can specify either edge triggering or level triggering.

    2. Serve many clients with each thread, and use nonblocking I/O and readiness change notification

    Readiness change notification (or edge-triggered readiness notification) means you give the kernel a file descriptor, and later, when that descriptor transitions from not ready to ready, the kernel notifies you somehow. It then assumes you know the file descriptor is ready, and will not send any more readiness notifications of that type for that file descriptor until you do something that causes the file descriptor to no longer be ready (e.g. until you receive the EWOULDBLOCK error on a send, recv, or accept call, or a send or recv transfers less than the requested number of bytes).

    When you use readiness change notification, you must be prepared for spurious events, since one common implementation is to signal readiness whenever any packets are received, regardless of whether the file descriptor was already ready.

    This is the opposite of "level-triggered" readiness notification. It's a bit less forgiving of programming mistakes, since if you miss just one event, the connection that event was for gets stuck forever. Nevertheless, I have found that edge-triggered readiness notification made programming nonblocking clients with OpenSSL easier, so it's worth trying.

    [Banga, Mogul, Drusha '99] described this kind of scheme in 1999.

    There are several APIs which let the application retrieve 'file descriptor became ready' notifications:

    3. Serve many clients with each server thread, and use asynchronous I/O

    This has not yet become popular in Unix, probably because few operating systems support asynchronous I/O, also possibly because it (like nonblocking I/O) requires rethinking your application. Under standard Unix, asynchronous I/O is provided by the aio_ interface (scroll down from that link to "Asynchronous input and output"), which associates a signal and value with each I/O operation. Signals and their values are queued and delivered efficiently to the user process. This is from the POSIX 1003.1b realtime extensions, and is also in the Single Unix Specification, version 2.

    AIO is normally used with edge-triggered completion notification, i.e. a signal is queued when the operation is complete. (It can also be used with level triggered completion notification by calling aio_suspend(), though I suspect few people do this.)

    glibc 2.1 and later provide a generic implementation written for standards compliance rather than performance.

    Ben LaHaise's implementation for Linux AIO was merged into the main Linux kernel as of 2.5.32. It doesn't use kernel threads, and has a very efficient underlying api, but (as of 2.6.0-test2) doesn't yet support sockets. (There is also an AIO patch for the 2.4 kernels, but the 2.5/2.6 implementation is somewhat different.) More info:

    Suparna also suggests having a look at the the DAFS API's approach to AIO.

    Red Hat AS and Suse SLES both provide a high-performance implementation on the 2.4 kernel; it is related to, but not completely identical to, the 2.6 kernel implementation.

    In February 2006, a new attempt is being made to provide network AIO; see the note above about Evgeniy Polyakov's kevent-based AIO.

    In 1999, SGI implemented high-speed AIO for Linux. As of version 1.1, it's said to work well with both disk I/O and sockets. It seems to use kernel threads. It is still useful for people who can't wait for Ben's AIO to support sockets.

    The O'Reilly book POSIX.4: Programming for the Real World is said to include a good introduction to aio.

    A tutorial for the earlier, nonstandard, aio implementation on Solaris is online at Sunsite. It's probably worth a look, but keep in mind you'll need to mentally convert "aioread" to "aio_read", etc.

    Note that AIO doesn't provide a way to open files without blocking for disk I/O; if you care about the sleep caused by opening a disk file, Linus suggests you should simply do the open() in a different thread rather than wishing for an aio_open() system call.

    Under Windows, asynchronous I/O is associated with the terms "Overlapped I/O" and IOCP or "I/O Completion Port". Microsoft's IOCP combines techniques from the prior art like asynchronous I/O (like aio_write) and queued completion notification (like when using the aio_sigevent field with aio_write) with a new idea of holding back some requests to try to keep the number of running threads associated with a single IOCP constant. For more information, see Inside I/O Completion Ports by Mark Russinovich at sysinternals.com, Jeffrey Richter's book "Programming Server-Side Applications for Microsoft Windows 2000" (Amazon, MSPress), U.S. patent #06223207, or MSDN.

    4. Serve one client with each server thread

    ... and let read() and write() block. Has the disadvantage of using a whole stack frame for each client, which costs memory. Many OS's also have trouble handling more than a few hundred threads. If each thread gets a 2MB stack (not an uncommon default value), you run out of *virtual memory* at (2^30 / 2^21) = 512 threads on a 32 bit machine with 1GB user-accessible VM (like, say, Linux as normally shipped on x86). You can work around this by giving each thread a smaller stack, but since most thread libraries don't allow growing thread stacks once created, doing this means designing your program to minimize stack use. You can also work around this by moving to a 64 bit processor.

    The thread support in Linux, FreeBSD, and Solaris is improving, and 64 bit processors are just around the corner even for mainstream users. Perhaps in the not-too-distant future, those who prefer using one thread per client will be able to use that paradigm even for 10000 clients. Nevertheless, at the current time, if you actually want to support that many clients, you're probably better off using some other paradigm.

    For an unabashedly pro-thread viewpoint, see Why Events Are A Bad Idea (for High-concurrency Servers) by von Behren, Condit, and Brewer, UCB, presented at HotOS IX. Anyone from the anti-thread camp care to point out a paper that rebuts this one? :-)

    LinuxThreads

    LinuxTheads is the name for the standard Linux thread library. It is integrated into glibc since glibc2.0, and is mostly Posix-compliant, but with less than stellar performance and signal support.

    NGPT: Next Generation Posix Threads for Linux

    NGPT is a project started by IBM to bring good Posix-compliant thread support to Linux. It's at stable version 2.2 now, and works well... but the NGPT team has announced that they are putting the NGPT codebase into support-only mode because they feel it's "the best way to support the community for the long term". The NGPT team will continue working to improve Linux thread support, but now focused on improving NPTL. (Kudos to the NGPT team for their good work and the graceful way they conceded to NPTL.)

    NPTL: Native Posix Thread Library for Linux

    NPTL is a project by Ulrich Drepper (the benevolent dict^H^H^H^Hmaintainer of glibc) and Ingo Molnar to bring world-class Posix threading support to Linux.

    As of 5 October 2003, NPTL is now merged into the glibc cvs tree as an add-on directory (just like linuxthreads), so it will almost certainly be released along with the next release of glibc.

    The first major distribution to include an early snapshot of NPTL was Red Hat 9. (This was a bit inconvenient for some users, but somebody had to break the ice...)

    NPTL links:

    Here's my try at describing the history of NPTL (see also Jerry Cooperstein's article):

    In March 2002, Bill Abt of the NGPT team, the glibc maintainer Ulrich Drepper, and others met to figure out what to do about LinuxThreads. One idea that came out of the meeting was to improve mutex performance; Rusty Russell et al subsequently implemented fast userspace mutexes (futexes)), which are now used by both NGPT and NPTL. Most of the attendees figured NGPT should be merged into glibc.

    Ulrich Drepper, though, didn't like NGPT, and figured he could do better. (For those who have ever tried to contribute a patch to glibc, this may not come as a big surprise :-) Over the next few months, Ulrich Drepper, Ingo Molnar, and others contributed glibc and kernel changes that make up something called the Native Posix Threads Library (NPTL). NPTL uses all the kernel enhancements designed for NGPT, and takes advantage of a few new ones. Ingo Molnar described the kernel enhancements as follows:

    While NPTL uses the three kernel features introduced by NGPT: getpid() returns PID, CLONE_THREAD and futexes; NPTL also uses (and relies on) a much wider set of new kernel features, developed as part of this project.

    Some of the items NGPT introduced into the kernel around 2.5.8 got modified, cleaned up and extended, such as thread group handling (CLONE_THREAD). [the CLONE_THREAD changes which impacted NGPT's compatibility got synced with the NGPT folks, to make sure NGPT does not break in any unacceptable way.]

    The kernel features developed for and used by NPTL are described in the design whitepaper, http://people.redhat.com/drepper/nptl-design.pdf ...

    A short list: TLS support, various clone extensions (CLONE_SETTLS, CLONE_SETTID, CLONE_CLEARTID), POSIX thread-signal handling, sys_exit() extension (release TID futex upon VM-release), the sys_exit_group() system-call, sys_execve() enhancements and support for detached threads.

    There was also work put into extending the PID space - eg. procfs crashed due to 64K PID assumptions, max_pid, and pid allocation scalability work. Plus a number of performance-only improvements were done as well.

    In essence the new features are a no-compromises approach to 1:1 threading - the kernel now helps in everything where it can improve threading, and we precisely do the minimally necessary set of context switches and kernel calls for every basic threading primitive.

    One big difference between the two is that NPTL is a 1:1 threading model, whereas NGPT is an M:N threading model (see below). In spite of this, Ulrich's initial benchmarks seem to show that NPTL is indeed much faster than NGPT. (The NGPT team is looking forward to seeing Ulrich's benchmark code to verify the result.)

    FreeBSD threading support

    FreeBSD supports both LinuxThreads and a userspace threading library. Also, a M:N implementation called KSE was introduced in FreeBSD 5.0. For one overview, see www.unobvious.com/bsd/freebsd-threads.html.

    On 25 Mar 2003, Jeff Roberson posted on freebsd-arch:

    ... Thanks to the foundation provided by Julian, David Xu, Mini, Dan Eischen, and everyone else who has participated with KSE and libpthread development Mini and I have developed a 1:1 threading implementation. This code works in parallel with KSE and does not break it in any way. It actually helps bring M:N threading closer by testing out shared bits. ...
    And in July 2006, Robert Watson proposed that the 1:1 threading implementation become the default in FreeBsd 7.x:
    I know this has been discussed in the past, but I figured with 7.x trundling forward, it was time to think about it again. In benchmarks for many common applications and scenarios, libthr demonstrates significantly better performance over libpthread... libthr is also implemented across a larger number of our platforms, and is already libpthread on several. The first recommendation we make to MySQL and other heavy thread users is "Switch to libthr", which is suggestive, also! ... So the strawman proposal is: make libthr the default threading library on 7.x.

    NetBSD threading support

    According to a note from Noriyuki Soda:
    Kernel supported M:N thread library based on the Scheduler Activations model is merged into NetBSD-current on Jan 18 2003.
    For details, see An Implementation of Scheduler Activations on the NetBSD Operating System by Nathan J. Williams, Wasabi Systems, Inc., presented at FREENIX '02.

    Solaris threading support

    The thread support in Solaris is evolving... from Solaris 2 to Solaris 8, the default threading library used an M:N model, but Solaris 9 defaults to 1:1 model thread support. See Sun's multithreaded programming guide and Sun's note about Java and Solaris threading.

    Java threading support in JDK 1.3.x and earlier

    As is well known, Java up to JDK1.3.x did not support any method of handling network connections other than one thread per client. Volanomark is a good microbenchmark which measures throughput in messsages per second at various numbers of simultaneous connections. As of May 2003, JDK 1.3 implementations from various vendors are in fact able to handle ten thousand simultaneous connections -- albeit with significant performance degradation. See Table 4 for an idea of which JVMs can handle 10000 connections, and how performance suffers as the number of connections increases.

    Note: 1:1 threading vs. M:N threading

    There is a choice when implementing a threading library: you can either put all the threading support in the kernel (this is called the 1:1 threading model), or you can move a fair bit of it into userspace (this is called the M:N threading model). At one point, M:N was thought to be higher performance, but it's so complex that it's hard to get right, and most people are moving away from it.

    5. Build the server code into the kernel

    Novell and Microsoft are both said to have done this at various times, at least one NFS implementation does this, khttpd does this for Linux and static web pages, and "TUX" (Threaded linUX webserver) is a blindingly fast and flexible kernel-space HTTP server by Ingo Molnar for Linux. Ingo's September 1, 2000 announcement says an alpha version of TUX can be downloaded from ftp://ftp.redhat.com/pub/redhat/tux, and explains how to join a mailing list for more info.
    The linux-kernel list has been discussing the pros and cons of this approach, and the consensus seems to be instead of moving web servers into the kernel, the kernel should have the smallest possible hooks added to improve web server performance. That way, other kinds of servers can benefit. See e.g. Zach Brown's remarks about userland vs. kernel http servers. It appears that the 2.4 linux kernel provides sufficient power to user programs, as the X15 server runs about as fast as Tux, but doesn't use any kernel modifications.  

    July 20

    C++备忘录

     

     在C++中,库的地位是非常高的。C++之父 Bjarne Stroustrup先生多次表示了设计库来扩充功能要好过设计更多的语法的言论。现实中,C++的库门类繁多,解决的问题也是极其广泛,库从轻量级到重量级的都有。不少都是让人眼界大开,亦或是望而生叹的思维杰作。由于库的数量非常庞大,而且限于笔者水平,其中很多并不了解。所以文中所提的一些库都是比较著名的大型库。

    C++各大有名库的介绍之C++标准库

      标准库中提供了C++程序的基本设施。虽然C++标准库随着C++标准折腾了许多年,直到标准的出台才正式定型,但是在标准库的实现上却很令人欣慰得看到多种实现,并且已被实践证明为有工业级别强度的佳作。

    1、Dinkumware C++ Library

    参考站点:http://www.dinkumware.com/

    P.J. Plauger编写的高品质的标准库。P.J. Plauger博士是Dr. Dobb's程序设计杰出奖的获得者。其编写的库长期被Microsoft采用,并且最近Borland也取得了其OEM的license,在其C/C+ +的产品中采用Dinkumware的库。

    2、RogueWave Standard C++ Library

    参考站点:http://www.roguewave.com/

    这个库在Borland C++ Builder的早期版本中曾经被采用,后来被其他的库给替换了。笔者不推荐使用。

    3、SGI STL

    参考站点:http://www.roguewave.com/

    SGI公司的C++标准模版库。

    4、STLport

    参考站点:http://www.stlport.org/

    SGI STL库的跨平台可移植版本。

    C++各大有名库的介绍——准标准库Boost

      Boost库是一个经过千锤百炼、可移植、提供源代码的C++库,作为标准库的后备,是C++标准化进程的发动机之一。 Boost库由C++标准委员会库工作组成员发起,在C++社区中影响甚大,其成员已近2000人。 Boost库为我们带来了最新、最酷、最实用的技术,是不折不扣的“准”标准库。

    Boost中比较有名气的有这么几个库:

    Regex
    正则表达式库

    Spirit
    LL parser framework,用C++代码直接表达EBNF

    Graph
    图组件和算法

    Lambda
    在调用的地方定义短小匿名的函数对象,很实用的functional功能

    concept check
    检查泛型编程中的concept

    Mpl
    用模板实现的元编程框架

    Thread
    可移植的C++多线程库

    Python
    把C++类和函数映射到Python之中

    Pool
    内存池管理

    smart_ptr
    5个智能指针,学习智能指针必读,一份不错的参考是来自CUJ的文章:

    Smart Pointers in Boost,哦,这篇文章可以查到,CUJ是提供在线浏览的。中文版见笔者在《Dr.Dobb's Journal软件研发杂志》第7辑上的译文。

      Boost总体来说是实用价值很高,质量很高的库。并且由于其对跨平台的强调,对标准C++的强调,是编写平台无关,现代C++的开发者必备的工具。但是Boost中也有很多是实验性质的东西,在实际的开发中实用需要谨慎。并且很多Boost中的库功能堪称对语言功能的扩展,其构造用尽精巧的手法,不要贸然的花费时间研读。Boost另外一面,比如Graph这样的库则是具有工业强度,结构良好,非常值得研读的精品代码,并且也可以放心的在产品代码中多多利用。

    参考站点:http://www.boost.org

    (国内镜像:http://www.c-view.org/tech/lib/boost/index.htm

    C++各大有名库的介绍——GUI

      在众多C++的库中,GUI部分的库算是比较繁荣,也比较引人注目的。在实际开发中,GUI库的选择也是非常重要的一件事情,下面我们综述一下可选择的GUI库,各自的特点以及相关工具的支持。

    1、MFC

      大名鼎鼎的微软基础类库(Microsoft Foundation Class)。大凡学过VC++的人都应该知道这个库。虽然从技术角度讲,MFC是不大漂亮的,但是它构建于Windows API 之上,能够使程序员的工作更容易,编程效率高,减少了大量在建立 Windows 程序时必须编写的代码,同时它还提供了所有一般 C++ 编程的优点,例如继承和封装。MFC 编写的程序在各个版本的Windows操作系统上是可移植的,例如,在Windows 3.1下编写的代码可以很容易地移植到 Windows NT 或 Windows 95 上。但是在最近发展以及官方支持上日渐势微。

    2、QT

    参考网站:http://www.trolltech.com

      Qt是Trolltech公司的一个多平台的C++图形用户界面应用程序框架。它提供给应用程序开发者建立艺术级的图形用户界面所需的所用功能。Qt是完全面向对象的很容易扩展,并且允许真正地组件编程。自从1996年早些时候,Qt进入商业领域,它已经成为全世界范围内数千种成功的应用程序的基础。 Qt也是流行的Linux桌面环境KDE 的基础,同时它还支持Windows、Macintosh、Unix/X11等多种平台。

    3、WxWindows

    参考网站:http://www.wxwindows.org

      跨平台的GUI库。因为其类层次极像MFC,所以有文章介绍从MFC到WxWindows的代码移植以实现跨平台的功能。通过多年的开发也是一个日趋完善的GUI库,支持同样不弱于前面两个库。并且是完全开放源代码的。新近的C++ Builder X的GUI设计器就是基于这个库的。

    4、Fox

    参考网站:http://www.fox-toolkit.org/

      开放源代码的GUI库。作者从自己亲身的开发经验中得出了一个理想的GUI库应该是什么样子的感受出发,从而开始了对这个库的开发。有兴趣的可以尝试一下。

    5、WTL

      基于ATL的一个库。因为使用了大量ATL的轻量级手法,模板等技术,在代码尺寸,以及速度优化方面做得非常到位。主要面向的使用群体是开发COM轻量级供网络下载的可视化控件的开发者。

    6、GTK

    参考网站:http://gtkmm.sourceforge.net/

      GTK是一个大名鼎鼎的C的开源GUI库。在Linux世界中有Gnome这样的杀手应用。而Qt就是这个库的C++封装版本。

    C++各大有名库的介绍——网络通信

    1、ACE

    参考网站:http://www.cs.wustl.edu/~schmidt/ACE.html

      C++库的代表,超重量级的网络通信开发框架。ACE自适配通信环境(Adaptive Communication Environment)是可以自由使用、开放源代码的面向对象框架,在其中实现了许多用于并发通信软件的核心模式。ACE提供了一组丰富的可复用C++ 包装外观(Wrapper Facade)和框架组件,可跨越多种平台完成通用的通信软件任务,其中包括:事件多路分离和事件处理器分派、信号处理、服务初始化、进程间通信、共享内存管理、消息路由、分布式服务动态(重)配置、并发执行和同步,等等。

    2、StreamModule

    参考网站:http://www.omnifarious.org/StrMod

      设计用于简化编写分布式程序的库。尝试着使得编写处理异步行为的程序更容易,而不是用同步的外壳包起异步的本质。

    3、SimpleSocket

    参考网站:http://home.hetnet.nl/~lcbokkers/simsock.htm

      这个类库让编写基于socket的客户/服务器程序更加容易。

    4、A Stream Socket API for C++

    参考网站:http://www.pcs.cnu.edu/~dgame/sockets/socketsC++/sockets.html

      又一个对Socket的封装库。

    C++各大有名库的介绍——XML

    1、Xerces

    参考网站:http://xml.apache.org/xerces-c/

      Xerces-C++ 是一个非常健壮的XML解析器,它提供了验证,以及SAX和DOM API。XML验证在文档类型定义(Document Type Definition,DTD)方面有很好的支持,并且在2001年12月增加了支持W3C XMLSchema 的基本完整的开放标准。

    2、XMLBooster

    参考网站:http://www.xmlbooster.com/

      这个库通过产生特制的parser的办法极大的提高了XML解析的速度,并且能够产生相应的GUI程序来修改这个parser。在DOM和SAX两大主流XML解析办法之外提供了另外一个可行的解决方案。

    3、Pull Parser

    参考网站:http://www.extreme.indiana.edu/xgws/xsoap/xpp

      这个库采用pull方法的parser。在每个SAX的parser底层都有一个pull的parser,这个xpp把这层暴露出来直接给大家使用。在要充分考虑速度的时候值得尝试。

    4、Xalan

    参考网站:http://xml.apache.org/xalan-c/

      Xalan是一个用于把XML文档转换为HTML,纯文本或者其他XML类型文档的XSLT处理器。

    5、CMarkup

    参考网站:http://www.firstobject.com/xml.htm

      这是一种使用EDOM的XML解析器。在很多思路上面非常灵活实用。值得大家在DOM和SAX之外寻求一点灵感。

    6、libxml++

    http://libxmlplusplus.sourceforge.net/

      libxml++是对著名的libxml XML解析器的C++封装版本。

    C++各大有名库的介绍——科学计算

    1、Blitz++

    参考网站:http://www.oonumerics.org/blitz

      Blitz++ 是一个高效率的数值计算函数库,它的设计目的是希望建立一套既具像C++ 一样方便,同时又比Fortran速度更快的数值计算环境。通常,用C++所写出的数值程序,比 Fortran慢20%左右,因此Blitz++正是要改掉这个缺点。方法是利用C++的template技术,程序执行甚至可以比Fortran更快。

      Blitz++目前仍在发展中,对于常见的SVD,FFTs,QMRES等常见的线性代数方法并不提供,不过使用者可以很容易地利用Blitz++所提供的函数来构建。

    2、POOMA

    参考网站:http://www.codesourcery.com/pooma/pooma

      POOMA是一个免费的高性能的C++库,用于处理并行式科学计算。POOMA的面向对象设计方便了快速的程序开发,对并行机器进行了优化以达到最高的效率,方便在工业和研究环境中使用。

    3、MTL

    参考网站:http://www.osl.iu.edu/research/mtl

      Matrix Template Library(MTL)是一个高性能的泛型组件库,提供了各种格式矩阵的大量线性代数方面的功能。在某些应用使用高性能编译器的情况下,比如Intel的编译器,从产生的汇编代码可以看出其与手写几乎没有两样的效能。

    4、CGAL

    参考网站:www.cgal.org

      Computational Geometry Algorithms Library的目的是把在计算几何方面的大部分重要的解决方案和方法以C++库的形式提供给工业和学术界的用户。

    C++各大有名库的介绍——游戏开发

    1、Audio/Video 3D C++ Programming Library

    参考网站:http://www.galacticasoftware.com/products/av/
      AV3D是一个跨平台,高性能的C++库。主要的特性是提供3D图形,声效支持(SB,以及S3M),控制接口(键盘,鼠标和遥感),XMS。

    2、KlayGE

    参考网站:http://home.g365.net/enginedev/

      国内游戏开发高手自己用C++开发的游戏引擎。KlayGE是一个开放源代码、跨平台的游戏引擎,并使用Python作脚本语言。KlayGE在LGPL协议下发行。感谢龚敏敏先生为中国游戏开发事业所做出的贡献。

    3、OGRE

    参考网站:http://www.ogre3d.org

      OGRE(面向对象的图形渲染引擎)是用C++开发的,使用灵活的面向对象3D引擎。它的目的是让开发者能更方便和直接地开发基于3D硬件设备的应用程序或游戏。引擎中的类库对更底层的系统库(如:Direct3D和OpenGL)的全部使用细节进行了抽象,并提供了基于现实世界对象的接口和其它类。

    C++各大有名库的介绍——线程

    1、C++ Threads

    参考网站:http://threads.sourceforge.net/

      这个库的目标是给程序员提供易于使用的类,这些类被继承以提供在Linux环境中很难看到的大量的线程方面的功能。

    2、ZThreads

    参考网站:http://zthread.sourceforge.net/

      一个先进的面向对象,跨平台的C++线程和同步库。

    C++各大有名库的介绍——序列化

    1、s11n

    参考网站:http://s11n.net/

      一个基于STL的C++库,用于序列化POD,STL容器以及用户定义的类型。

    2、Simple XML Persistence Library

    参考网站:http://sxp.sourceforge.net/

      这是一个把对象序列化为XML的轻量级的C++库。

    C++各大有名库的介绍——字符串

    1、C++ Str Library

    参考网站:http://www.utilitycode.com/str/

      操作字符串和字符的库,支持Windows和支持gcc的多种平台。提供高度优化的代码,并且支持多线程环境和Unicode,同时还有正则表达式的支持。

    2、Common Text Transformation Library

    参考网站:http://cttl.sourceforge.net/

      这是一个解析和修改STL字符串的库。CTTL substring类可以用来比较,插入,替换以及用EBNF的语法进行解析。

    3、GRETA

    参考网站:http://research.microsoft.com/projects/greta/

      这是由微软研究院的研究人员开发的处理正则表达式的库。在小型匹配的情况下有非常优秀的表现。

    C++各大有名库的介绍——综合

    1、P::Classes

    参考网站:http://pclasses.com/

      一个高度可移植的C++应用程序框架。当前关注类型和线程安全的signal/slot机制,i/o系统包括基于插件的网络协议透明的i/o架构,基于插件的应用程序消息日志框架,访问sql数据库的类等等。

    2、ACDK - Artefaktur Component Development Kit

    参考网站:http://acdk.sourceforge.net/

      这是一个平台无关的C++组件框架,类似于Java或者.NET中的框架(反射机制,线程,Unicode,废料收集,I/O,网络,实用工具,XML,等等),以及对Java, Perl, Python, TCL, Lisp, COM 和 CORBA的集成。

    3、dlib C++ library

    参考网站:http://www.cis.ohio-state.edu/~kingd/dlib/

      各种各样的类的一个综合。大整数,Socket,线程,GUI,容器类,以及浏览目录的API等等。

    4、Chilkat C++ Libraries

    参考网站:http://www.chilkatsoft.com/cpp_libraries.asp

      这是提供zip,e-mail,编码,S/MIME,XML等方面的库。

    5、C++ Portable Types Library (PTypes)

    参考网站:http://www.melikyan.com/ptypes/

      这是STL的比较简单的替代品,以及可移植的多线程和网络库。

    6、LFC

    参考网站:http://lfc.sourceforge.net/

      哦,这又是一个尝试提供一切的C++库

    C++各大有名库的介绍——其他库

    1、Loki

    参考网站:http://www.moderncppdesign.com/

      哦,你可能抱怨我早该和Boost一起介绍它,一个实验性质的库。作者在loki中把C++模板的功能发挥到了极致。并且尝试把类似设计模式这样思想层面的东西通过库来提供。同时还提供了智能指针这样比较实用的功能。

    2、ATL

      ATL(Active Template Library)是一组小巧、高效、灵活的类,这些类为创建可互操作的COM组件提供了基本的设施。

    3、FC++: The Functional C++ Library

      这个库提供了一些函数式语言中才有的要素。属于用库来扩充语言的一个代表作。如果想要在OOP之外寻找另一分的乐趣,可以去看看函数式程序设计的世界。大师Peter Norvig在 “Teach Yourself Programming in Ten Years”一文中就将函数式语言列为至少应当学习的6类编程语言之一。

    4、FACT!

    参考网站:http://www.kfa-juelich.de/zam/FACT/start/index.html

      另外一个实现函数式语言特性的库

    5、Crypto++

      提供处理密码,消息验证,单向hash,公匙加密系统等功能的免费库。

      还有很多非常激动人心或者是极其实用的C++库,限于我们的水平以及文章的篇幅不能包括进来。在对于这些已经包含近来的库的介绍中,由于并不是每一个我们都使用过,所以难免有偏颇之处,请读者见谅。

    C++名人的网站

    1、Bjarne Stroustrup

    http://www.research.att.com/~bs/

    2、Stanley B. Lippman

    http://blogs.msdn.com/slippman/ (中文版)

    http://www.zengyihome.net/slippman/index.htm

    3、Scott Meyers

    http://www.aristeia.com/

    4、David Musser

    http://www.cs.rpi.edu/~musser/

    5、Bruce Eckel

    http://www.bruceeckel.com

    http://blog.csdn.net/beckel Bruce Eckel 博客中文版

    6、Nicolai M. Josuttis

    http://www.josuttis.com/

    7、Herb Sutter

    http://www.gotw.ca/

    http://blog.csdn.net/hsutter/ Herb Sutter 中文博客

    8、Andrei Alexandrescu

    http://www.moderncppdesign.com

     

    9、 侯捷先生
    http://www.jjhou.com
    10、孟岩先生
       先生繁忙于工作,痴迷于技术,暂无个人主页,关于先生的作品可以通过CSDN的专栏和侯先生的主页访问到。
    11、 荣耀先生
    http://www.royaloo.com/
    12、 潘爱民先生
    http://www.icst.pku.edu.cn/panaimin/pam_homepage.htm


       除了上述大师的主页外,以下的综合类C++学习参考站点是我们非常愿意向大家推荐的:
       (1) CodeProject
    http://www.codeproject.com
       (2) CodeGuru
    http://www.codeguru.com
       (3) Dr. Dobb's Journal
    http://www.ddj.com
       (4) C/C++ Users Journal
    http://www.cuj.com
       (5) C维视点
    http://www.c-view.org
       (6) allaboutprogram
    http://www.allaboutprogram.com
       其他资料
       (1) ISO IEC JTC1/SC22/WG21 - C++:标准C++的权威参考
    http://anubis.dkuug.dk/jtc1/sc22/wg21/
       (2) C++ FAQ LITE — Frequently Asked Questions: 最为全面的C++FAQ
    http://www.sunistudio.com/cppfaq/index.html

    C++开源跨平台类库及在VC++.net中应用的配置

        在如下的库支持下,开发的系统可以很方便移植到当前大部分平台上运行而无需改动,只需在对应的平台下 用你喜欢的编译器重新编译即可。

    经典的C++库
      STLport-------SGI STL库的跨平台可移植版本,在以前有些编译器离符合标准比较远的情况下 那时还是有用的,当然目前vc71已经比较接近标准了,故目前不怎么用它了。

      Boost---------准标准库, 功能强大 涉及能想的到的大部分非特别领域的算法,有一个大的C++社区支持。

      WxWindows-----功能强大的跨平台GUI库 ,它的功能和结构都类似 MFC,故原则上可以通过WxWindows把现有MFC程序移植到非Win平台下。

      Blitz---------高效率的数值计算函数库 ,你可以订制补充你需要的算法。

      Log4cpp-------日志处理 ,功能类似java中的log4j。

      ACE-----------自适应通讯环境, 重量级的通讯环境库。

      Crypto++ -----加/解密算法库, 非常专业的C++ 密码学函式库。

      CppUnit --- 一个c++的单元测试框架 类似 java 的JUnit。

      Loki ------- 一个实验性质的库,尝试把类似设计模式这样思想层面的东西通过库来提供,他是C++的一个模板库,系C++"贵族", 它把C++模板的功能发挥到了极致。

    学术性的C++库:

      FC++ --------The Functional C++ Library ,用库来扩充语言的一个代表作 ,模板库。

      CGAL ------- Computational Geometry Algorithms Library计算几何方面的大部分重要的解决方案和方法以C++库的形式提供给工业和学术界的用户。

    其它目前我感觉还不是很爽的C++库:

      Doxygen ----注释文档生成工具 ,可恨的是我找不到 windows版本。

      QT ----------大名顶顶的一个多平台的C++图形用户界面应用程序框架(GUI库)可气的是他的 Windows版 是商业发布的要付费。

      xml4c--------IBM开发的XML Parser,系超重量级的, 适用大型应用中, 其DLL有 12M,恐怖吧。

      Xerces c++ --Apache的XML项目, 但 只支持少数的字符编码,如ASCII,UTF-8,UTF-16等,不能处理包含中文字符的XML文档。

      XMLBooster ----- 也是一种 XML的 解析工具。

      Fox -------又一种开放源代码(C++)的GUI库,功能不是很强。

    C++开发环境(Win平台下除了 Visual C++ 和 Borland C++以外的):

      Cygwin --------Windows下的一个Unix仿真环境。

      MinGW --------GCC的一个Windows移植版本。

      Dev C++ -------- 一个C/C++ 的集成开发环境,在Windows上的C++编译器一直和标准有着一段距离的时候,GCC就是一个让Windows下开发者流口水的编译器。

      Eclipse-CDT ----IMB 开发的一个集成开发环境,一般用来作为Java 开发环境,但由于Eclipse 是通过插件体系来扩展功能,这里我们 安装 CDT插件后,就可以用来作为C++ 的集成开发环境。

    经典的C++库在VC++.net中应用的配置
    以下以 vc71环境 为例,其他环境 见各软件包的说明文档。

    1. STLport (SGI STL库的跨平台可移植版本。)
    -------http://www.stlport.org

    vc71环境中编译安装
    版本:STLport-4.6.2.tar.gz
    copy vc71.mak makefile
    nmake clean all

    头文件在 %STLport_root%/include\stlport
    库文件在 %STLport_root%/lib

    头文件添加方法如:
    #include 需要链接lib库

    2 WxWindows (跨平台的GUI库)
    --------http://www.wxwindows.org
    --------http://sourceforge.net/projects/wxwindows
    --------http://i18n.linux.net.cn/others/wxWindowstut/wxTutorial.html

      因为其类层次极像MFC,所以有文章介绍从MFC到WxWindows的代码移植以实现跨平台的功能。通过多年的开发也是一个日趋完善的GUI库,支持同样不弱于前面两个库。并且是完全开放源代码的。新近的C++ Builder X的GUI设计器就是基于这个库的。

    vc71环境中编译安装
    版本:wxMSW-2.6.0-Setup.exe
    copy makefile.vc makefile
    通过 配置 config.vc 的 SHARED = 0 和 BUILD = debug
    确定 nmake clean all 的四种编译结果:

    include头文件: include\wx
    Lib库文件: lib\vc_dll 和 lib\vc_lib
    DLL: lib\vc_dll

    头文件在 %wxWidgets_root%/include\wx
    库文件在 %wxWidgets_root%/lib\vc_dll 和 %wxWidgets_root%/lib\vc_lib

    头文件添加方法如:
    #include 需要链接lib库

    3 boost (“准”标准库)
    ------http://www.boost.org/
    ------http://sourceforge.net/projects/boost/

      Boost库是一个经过千锤百炼、可移植、提供源代码的C++库,作为标准库的后备,是C++标准化进程的发动机之一。 Boost库由C++标准委员会库工作组成员发起,在C++社区中影响甚大,其成员已近2000人。 Boost库为我们带来了最新、最酷、最实用的技术,是不折不扣的“准”标准库。

    vc71环境中编译安装
    版本:boost_1_32_0.exe

    首先进入 tools\build\jam_src 运行 build.bat 得到一个工具: bjam.exe
    将其复制到 boost_root 目录下
    执行 bjam "-sTOOLS=vc-7_1" stage 开始编译 (bjam "-sTOOLS=vc-7_1" install)

    头文件在 %boost_root%/boost
    库文件在 %boost_root%/stage\lib

    头文件添加方法如:
    #include 有时要链接lib库

      Boost中比较有名气的有这么几个库:
      Regex正则表达式库
      Spirit
      LL parser framework,用C++代码直接表达EBNF
      Graph图组件和算法
      Lambda在调用的地方定义短小匿名的函数对象,很实用的functional功能
      concept check检查泛型编程中的concept
      Mpl用模板实现的元编程框架
      Thread可移植的C++多线程库
      Python把C++类和函数映射到Python之中
      Pool内存池管理
      smart_ptr5个智能指针,学习智能指针必读,一份不错的参考是来自CUJ的文章:Smart Pointers in Boost,哦,这篇文章可以查到,CUJ是提供在线浏览的。

      Boost总体来说是实用价值很高,质量很高的库。并且由于其对跨平台的强调,对标准C++的强调,是编写平台无关,现代C++的开发者必备的工具。但是Boost中也有很多是实验性质的东西,在实际的开发中实用需要谨慎。并且很多Boost中的库功能堪称对语言功能的扩展,其构造用尽精巧的手法,不要贸然的花费时间研读。Boost另外一面,比如Graph这样的库则是具有工业强度,结构良好,非常值得研读的精品代码,并且也可以放心的在产品代码中多多利用。

    4 blitz (高效率的数值计算函数库)
    ------http://folk.uio.no/patricg/blitz/html/index.html
    ------http://www.oonumerics.org/blitz/
    ------http://sourceforge.net/projects/blitz/

      Blitz++ 是一个高效率的数值计算函数库,它的设计目的是希望建立一套既具像C++ 一样方便,同时又比Fortran速度更快的数值计算环境。通常,用C++所写出的数值程序,比 Fortran慢20%左右,因此Blitz++正是要改掉这个缺点。方法是利用C++的template技术,程序执行甚至可以比Fortran更快。

      Blitz++目前仍在发展中,对于常见的SVD,FFTs,QMRES等常见的线性代数方法并不提供,不过使用者可以很容易地利用Blitz++所提供的函数来构建。

    vc71环境中编译安装
    版本:blitz-0.8.tar.gz

    将 blitz-0.8/Blitz-VS.NET.zip 解压到当前目录下
    打开 Blitz-Library.sln 编译即可

    头文件在 %blitz_root%/blitz
    %blitz_root%/random
    库文件在 %blitz_root%/lib (静态库)

    头文件添加方法如:
    #include 有时要链接lib库
    #include 不需要lib库

    5 log4cpp (日志处理)
    -------http://sourceforge.net/projects/log4cpp/
    -------http://log4cpp.hora-obscura.de/index.php/Main_Page

      Log4cpp 是 Log4J 的 C++ 移植版本,开放源代码并且完全免费。与 Log4J 能够跨平台一样,Log4cpp也致力于写出跨平台的 C++ 程序。Log4cpp 主要是用于 C++ 程序中写 log 文件,与此同时,Log4cpp 中有很多有用的类库,对于写跨平台 C++ 程序的人来说,可以直接拿来用,或者作为自己写跨平台类的参考。

      Log4cpp 中的跨平台类库有明显的 Java 痕迹,比如 Class、Object 、Loader、Locale 等类。 Log4cpp
    中的类都可以根据类名 new 出一个 instance,其实现的方式和 MFC 如出一辙:通过 C++ 强大的宏来实现。

    Log4cpp 中的跨平台类库主要有:

    信号类:Condition(broadcast,signal,wait),CriticalSection (lock,unlock),WaitAccess,
    Event(set,reset,wait),Mutex(lock,unlock), Semaphore(wait,tryWait,post)

    网络类:InetAddress,Socket,ServerSocket,DatagramSocket,SocketInputStream,
    SocketOutputStream

    日期类:DateFormat,DateTimeDateFormat,System(currentTimeMillis)

    文件类:FileWatchdog(doOnChange)

    内存操作类:基于引用计数机制的智能指针 ObjectPtrT
    字符串操作类:StrictMath,StringHelper(toUpperCase,toLowerCase,trim,equalsIgnoreCase,endsWith,format),StringTokenizer

    线程类:Thread(start,run,join)
      使用以上的类不用考虑 thread handle, event handle, socket handle 之类的 handle 问题,所有这些文
    件已经被封装了。很好用,对不对?不足之处在于没有 GUI 类。ANSI C++ 中对于目录等文件系统的处理功能较弱,这里面也没有目录处理类。另外 Socket 的 read(void * buf, size_t len) 不能设置 timeout,并且如果读取数据个数小于 len 那么 read 函数将一直堵塞,不太好用,很可惜。实际的使用上面,可以考虑做一个 Socket 子类,重写 read() 函数。

    vc71环境中编译安装
    版本:log4cpp-0.3.5rc1.tar.gz

    打开 msvc6 编译即可

    头文件在 %log4cpp_root%/include\log4cpp
    库文件在 %log4cpp_root%/lib

    头文件添加方法如:
    #include 需要链接lib库

    6 Crypto++ 加/解密算法库
    ---http://sourceforge.net/projects/cryptopp/
    ---http://www.eskimo.com/~weidai/cryptlib.html
    ---http://www.cryptopp.com

      提供处理密码,消息验证,单向hash,公匙加密系统等功能的免费库。

      Crypto++ 是一个非常专业的C++ 密码学函式库,几乎在密码学里头常见的演算法都可以在Crypto++
    找到实作的函式,如:block 与stream ciphers,hash functions,MACs,random number generators,public key 加密...等方法

    vc71环境中编译安装
    版本:cryptopp521.zip

    直接通过 cryptest.dsw 相关的库

    头文件在 %cryptopp_root%
    库文件在 %cryptopp_root%/lib

    头文件添加方法如:
    #include <*.h> 需要链接lib库

    7 ACE

    ------http://www.cs.wustl.edu/~schmidt/ACE.html

      C+ +库的代表,超重量级的网络通信开发框架。ACE自适配通信环境(Adaptive Communication Environment)是可以自由使用、开放源代码的面向对象框架,在其中实现了许多用于并发通信软件的核心模式。ACE提供了一组丰富的可复用C++ 包装外观(Wrapper Facade)和框架组件,可跨越多种平台完成通用的通信软件任务,其中包括:

      事件多路分离和事件处理器分派、信号处理、服务初始化、进程间通信、共享内存管理、消息路由、分布式服务动态(重)配置、并发执行和同步,等等。

    8. CppUnit
    -------http://sourceforge.net/projects/cppuint/

      一个c++的单元测试框架,可以通过派生测试类的方式,定制具体的测试方案。xUnit家族的一员,从JUnit移植而来,JUnit是Java语言的单元测试框架。

    vc71环境中编译安装
    版本:cppunit-1.10.2.tar.gz

    直接通过 CppUnitLibraries.dsw 编译相关的库

    头文件在 %cppunit_root%/cppunit
    库文件在 %cppunit_root%/lib

    头文件添加方法如:
    #include 需要链接lib库

    9 Loki
    -----http://moderncppdesign.com
    -----http://sourceforge.net/projects/loki-lib/
    -----http://sourceforge.net/projects/loki-exp/

      其实可和Boost一起介绍它,一个实验性质的库。作者在loki中把C++模板的功能发挥到了极致。并且尝试把类似设计模式这样思想层面的东西通过库来提供。同时还提供了智能指针这样比较实用的功能。

      该库系模板库,库本身无需编译,在你的工程文件中 引用头文件就可以使用,如果 你直接或间接使用了small object,那你需要在你的工程文件加上SmallObj.cpp;如果 你直接或间接使用了Singletons,那你需要在你的工程文件 加上 Singleton.cpp

    学术性的C++库的详细介绍:
    1 FC++: The Functional C++ Library
    --------http://www.cc.gatech.edu/~yannis/fc++/

      这个库提供了一些函数式语言中才有的要素。属于用库来扩充语言的一个代表作。如果想要在OOP之外寻找另一分的乐趣,可以去看看函数式程序设计的世界。大师Peter Norvig在 “Teach Yourself Programming in
    Ten Years”一文中就将函数式语言列为至少应当学习的6类编程语言之一。

    当前版本:FC++.1.5.zip
    模板库,在实际工程中 ,加上要用的头文件 就可以编译。

    2 CGAL
    -----http://www.cgal.org

      Computational Geometry Algorithms Library的目的是把在计算几何方面的大部分重要的解决方案和方
    法以C++库的形式提供给工业和学术界的用户。

    当前版本:CGAL-3.1.zip
    这是一个已编译的版本,当然也包括完整的源码

    头文件在 %CGAL_root%/include/CGAL
    库文件在 %CGAL_root%/lib/msvc7

    头文件添加方法如:
    #include 需要链接lib库

    其它目前我感觉还不是很爽的C++库的详细介绍:
    1 Doxygen
    ------http://sourceforge.net/projects/doxygen/
    ------http://www.stack.nl/~dimitri/doxygen/

      注释文档生成工具,较之Doc++功能更为齐全,可以生成包括HTML、PDF、RTF在内的多种格式的文档,并有GUI界面,除了支持c/c++语言外,还支持IDL、java、PHP、c#等。

    2、 QT(windows版要付钱)
    -------http://www.trolltech.com/
    -------http://www.qiliang.net/qt.html

      Qt是Trolltech公司的一个多平台的C++图形用户界面应用程序框架。它提供给应用程序开发者建立艺术级的图形用户界面所需的所用功能。Qt 是完全面向对象的很容易扩展,并且允许真正地组件编程。自从1996年早些时候,Qt进入商业领域,它已经成为全世界范围内数千种成功的应用程序的基础。 Qt也是流行的Linux桌面环境KDE 的基础,同时它还支持Windows、Macintosh、Unix/X11等多种平台。

    3、Fox
    ---------http://www.fox-toolkit.org/

      开放源代码的GUI库。作者从自己亲身的开发经验中得出了一个理想的GUI库应该是什么样子的感受
    出发,从而开始了对这个库的开发。有兴趣的可以尝试一下。

    4 xml4c
    ------http://www.alphaworks.ibm.com/tech/xml4c

      IBM的XML Parser,用c++语言写就,功能超级强大。号称支持多达100种字符编码,能够支持中文,适合于大规模的xml应用。若只是很小范围的应用,则非最佳选择,毕竟,你需要“背负”约12M左右的dll的沉重负担。

    5 Xerces c++
    -------http://xml.apache.org/xerces-c

      Apache的XML项目,同样是c++ 实现,来源于IBM的xml4c,因此编程接口也是和xml4c一致的。但是目前只支持少数的字符编码,如ASCII,UTF-8,UTF-16等,不能处理包含中文字符的XML文档。

      Xerces-C++ 是一个非常健壮的XML解析器,它提供了验证,以及SAX和DOM API。XML验证在文档类型定义(Document Type Definition,DTD)方面有很好的支持,并且在2001年12月增加了支持W3C XML Schema的基本完整的开放标准。

    6 XMLBooster
    -------http://www.xmlbooster.com/

      这个库通过产生特制的parser的办法极大的提高了XML解析的速度,并且能够产生相应的GUI程序来修改这个parser。在DOM和SAX两大主流XML解析办法之外提供了另外一个可行的解决方案。

    C++开发环境(Win平台下除了 Visual C++ 和 Borland C++以外的):

    1. Cygwin (Windows下的一个Unix仿真环境)

      这个Cygwin的一部分是GCC的另外一个Windows移植版本,Cygwin是Windows下的一个Unix仿真环境。严格的说是模拟GNU的环境,这也就是"Gnu's Not Unix"要表达的意思。

      至Cygwin的網站http://www.cygwin.com/下載安裝程式setup.exe,可直接點選執行或先行下載至個人電腦後再執行。目前我已经下载到本地了,直接安装即可。

    2. MinGW (GCC的一个Windows移植版本)

    1)http://sourceforge.net/projects/mingw 直接访问的,点击 Files,然后下载以下文件:MinGW-3.1.0-1.exe, mingw32-make-3.80.0-3.exe。
    安装MinGW 到 C:/MinGW 目录下,然后安装 mingw32-make 到 C:/MinGW 下,通过浏览器
    到 C:/MinGW/bin 下,将 mingw32-make.exe 改名或者另外复制为 make.exe。

    (以上的设置已经足够。不过为了求新,我是同时下载了 gcc-core-3.4.2-20040916-1.tar.gz,mingw-runtime-3.5.tar.gz 和 w32api-3.1.tar.gz,将它们直接解压到 C:/MinGW 下更新旧的文件。不过这对这篇文章本身没有任何影响。新旧两种配置我都测试过。)

    安装次序:
    MinGW-3.1.0-1.exe
    mingw32-make-3.80.0-3.exe
    gcc-core-3.4.2-20040916-1.tar.gz
    mingw-runtime-3.5.tar.gz
    w32api-3.1.tar.gz
    gdb-5.2.1-1.exe
    mingw-utils-0.3.tar.gz
    binutils-2.15.91-20040904-1.tar.gz

    3)准备MinGW 用户开发的命令行环境(一个批处理)
    如: mingw.bat
    @rem --------------------------------------
    @SET MINGW_ROOT=D:\Mingw

    @rem
    @echo Setting environment for using Mingw.
    @rem

    @set PATH=%MINGW_ROOT%\BIN;%PATH%
    @set INCLUDE=%MINGW_ROOT%\INCLUDE;%MINGW_ROOT%\INCLUDE\c++\3.2.3;%MINGW_ROOT%\include\c++\3.2.3\mingw32;%MINGW_ROOT%\include\c++\3.2.3\backward;%INCLUDE%
    @set LIB=MINGW_ROOT\LIB;%LIB%
    @rem ----------------------------------------

    3. Dev C++ (一个C/C++ 的集成开发环境)

      GCC是一个很好的编译器。在Windows上的C++编译器一直和标准有着一段距离的时候,GCC就是一个让Windows下开发者流口水的编译器。Dev-C++就是能够让GCC跑在Windows下的工具,作为集成开发环境,还提供了同专业IDE相媲美的语法高亮,代码提示,调试等功能。由于使用Delphi开发,占用内存少,速度很快,比较适合轻量级的学习和使用。

      可以使用 MinGW-GCC 作为它的编译器

    4 Eclipse-CDT

    游戏开发

    Audio/Video 3D C++ Programming Library

    ------http://www.galacticasoftware.com/products/av/
    ------http://sourceforge.net/projects/av3d/

      AV3D是一个跨平台,高性能的C++库。主要的特性是提供3D图形,声效支持(SB,以及S3M),控制接口(键盘,鼠标和遥感),XMS。

    KlayGE

    ------http://home.g365.net/enginedev/
    ------http://sourceforge.net/projects/klayge/

      国内游戏开发高手自己用C++开发的一个开放源代码、跨平台的游戏引擎。KlayGE是一个开放源代码、跨平台的游戏引擎,并使用Python作脚本语言。KlayGE在LGPL协议下发行。感谢龚敏敏先生为中国游戏开发事业所做出的贡献。

    OGRE

    ------http://www.ogre3d.org
    ------http://www.ogre3d.org/docs/manual/
    ------http://sourceforge.net/projects/ogre

      OGRE(面向对象的图形渲染引擎)是用C++开发的,使用灵活的面向对象3D引擎。它的目的是让开发者能更方便和直接地开发基于3D硬件设备的应用程序或游戏。引擎中的类库对更底层的系统库(如:Direct3D和OpenGL)的全部使用细节进行了抽象,并提供了基于现实世界对象的接口和其它类。

    July 03

    春归何处

    清平乐·宋·黄庭坚

    春归何处?寂寞无行路。若有人知春去处,唤取归来同住。
    春无踪迹谁知,除非问取黄鹂。百啭无人能解,因风飞过蔷薇。
    June 26

    重温人生三重境界

    古之成大事业者,成大学问者必经人生三重境界

    第一重境界:昨夜西风凋碧树,独上高楼,望断天涯路.

    第二重境界:衣带渐宽终不悔,为伊消得人憔悴

    第三重境界:梦里寻他千百度,蓦然回首,那人确在,灯火阑珊处

                                                   -----王国维

    November 22

    borland -> CodeGear

    http://www.codegear.com/

    CodeGear := TCompany.Create();

    CodeGear = new TCompany();

    如果您今天沒到Borland的网站,請花点时间去看看。DelphiC++BuilderJBuilderInterBase等伟大的开发工具的所有者已经从borland变为CodeGear了,一个时代终于过去了。

    到底是技术改变了市场?还是市场改变了技术?

    November 19

    中国式创业最容易犯的100个错误

    生为商人没有错,但商旅途中一定会时常犯错。错而能知错而能改错,则善莫大焉,企业幸甚!

    1、哥们式合伙,仇人式散伙
    中国企业最常见的聚散模式——公司创办之初,合伙者们以感情和义气去处理相互关系,制度和股权或者没有确定,或者有而模糊。
    企业做大后,制度变得重要,利益开始惹眼,于是"排座次、分金银、论荣辱",企业不是剑拔弩张内耗不止,便是梁山英雄流云四散。

    2、盲目崇拜社会关系
    关系推动生产力,因此社会关系的建立和运用是商人必要的能力;但关系不等于生产力,把社会关系当成解决企业发展所有问题的灵丹妙药,忘记了"打铁还须自身硬"的真理,则企业本末倒置,大患迟早降临。

    3、迷信"空降兵"
    都说"外来的和尚会念经"。正确的做法应该是:不可不用"空降兵",不可乱用"空降兵",不可全用"空降兵"。这方面中国企业的教训已经太多,可永远会有人情不自禁地做错:放弃身边的人才,迷信远方的大师。

    4、企业支柱亲信化
    一个靠人控制人,而不是靠制度控制人的中国式组织。起源于农民打江山的传统,泛滥于信任危机加重的当代商业社会,是中国以情感为纽带的企业走向规范治理的主要瓶颈。

    5、面子大于真理
    面子是:我已经这样定了,而且全世界的人都知道了;真理是:这个方向是一条曲曲折折的弯路,而且很可能此路不通。爱面子的老板说:他*的就这么去,谁不执行谁下课,玩也要玩到底。

    6、商业式迷信
    罗盘神签加卦相,诚惶诚恐,测风水测人才;香火缭绕进庙堂,顶礼膜拜,求机运求财富。商海无情,翻云覆雨,谁来保佑?

    7、知人而不自知
    看人头头是道,看己昏头昏脑。从来没有看清自己在行业中领先的关键因素,一段成功史,满脑糊涂账。也因此,从来没有清晰的战略规划:坚持什么,改进什么;如何创新,如何固守。

    8、习惯性信用缺失
    说话不算数、合同不算数、承诺不算数,这几乎是中国商人部落最常见的景观。对内,规则计划变幻无穷,今天立,明天改,后天再改,手下无所适从;对外,合同承诺一张废纸,视情况涂抹、打折甚至撕毁,合作者有去无回。

    9、匪文化心态
    民营企业老板如山寨大王,生于青萍之末,长于江湖之野,走的是匪文化路线:关上山寨大门,老子天下第一;冲出山寨掠财,碰壁拐弯,见缝就钻。图的是人生痛快,少一份使命精神;既没有经济上的长远目标,也没有文化上的成熟主张。

    10、阶级斗争企业化
    企业内部可以搞平衡,但不可以搞斗争。"文化大革命"告诉我们,"挑起群众斗群众"最后所失去的,是企业的效率和凝聚力。
     
    11、沉湎酒色
    有人因为无力控制欲望沉湎酒色;有人因为事业再无激情沉湎酒色;有人因为"过去吃了苦",怀着找补回来的心态沉湎酒色;有人因为"人生苦短",信奉找钱是为了享受的哲学沉湎酒色。
    12、投资冒险主义
    拿自己"吃稀饭"的钱去搞投资,或者借来甚至骗来别人"吃稀饭"的钱去搞投资,所谓成败荣辱在此一举,身家性命系于一线,战战兢兢,急功近利,举止失措,焉能不败?
    13、投资经验主义
    在另一个时间、另一个市场、另一个行业,面对另一群员工或消费者,以当年的感觉投资、布局、生产、销售。指挥还是昨天的指挥,音乐还是相同的音乐,可这一次为何起舞者寥寥数人?
    14、投资极端主义
    三月前兴奋地投下钱来,三月后沮丧地要抽身离去,前脚踩油门,后脚踩刹车,企业振荡,落英缤纷......投资者的常见毛病,主要原因是对产业投资纵深化及企业竞争复杂化的估计不足。
    15、人力资源幻觉
    一方面永远高估员工的高度,一方面永远低估员工的水平。
    16、过度追求系统平衡
    企业总是由各个系统各个部门组成,它们彼此之间需要有一种动态的平衡。但老板过分看重平衡,在奖惩政策、人员提升、部门权限、业绩考核等方面一味强调"一碗水端平",最后优者不奖、错者不罚,所有部门都吃大锅饭,企业所要的平衡反而荡然无存。
    17、抬头批判潜规则,低头猛搞潜规则
    从不认为自己对理想社会的到来负有身体力行的责任。
    18、完美主义群众化
    完美主义不是坏事,但若将其扩大化,就会给个人和企业带来无尽的烦恼与麻烦。
    完美主义的老板总想达成最高的目标。他们对下属"高标准,严要求",因为求之深,所以责之切,总是有太高的眼光、太多的挑剔、太多的责备。
    19、附庸风雅
    一窝蜂登山,一窝蜂打高尔夫,一窝蜂EMBA,一窝蜂墙上挂艺术品......值得指出的是,这一切并不是因为爱好或需求,而是因为模仿及炫耀。
    20、不学无术
    老板每天要处理各种各样的情况,事情一多,就不愿意学习了。很多人不读书,不看报,不看电视,不上网,更不愿意专门花时间参加培训。在他们看来,市场是最好的老师,学习只是装点门面的过场罢了。由于长期沉溺于小圈子,信息封闭,知识结构老化,最终要么被市场淘汰,要么被主流遗忘。
    21、公司小皇帝心态
    人人三呼万岁,事事溜须拍马,恭顺者提拔,意见者遭殃,"我的地盘我作主"。
    22、擦边球情结
    总是在法律允许和禁止的边缘徘徊,总是希望利用政策的漏洞渔利。这些历史上打惯了擦边球的人们,在不用擦边更有胜算的新规则里,反而显得茫然失措,举手投足连连丢分。
    23、强于战术弱于战略
    这群商人的才华,几乎都表现在挽救一个错误的战略计划上了。
    24、强于战略弱于战术
    通俗地说,是想象力很够,行动力不够。当然按照他们自己的说法是,一个伟大的构想总是因为执行不到位而夭折。
    25、强烈的政治情节
    提到政治就兴奋,靠近政治就愉悦,企业里面玩政治,人生目标搞政治;经商只是为当官做准备——属中国传统价值观"当官才能光宗耀祖"的新时代折射。然而经验证明,政治是把双刃剑,一个优秀的企业家可以懂政治、学政治,但不可玩政治。
    26、自我膨胀
    这类商人的逻辑是:财富比别人多,所以才能就比别人够,见识就比别人广,基因就比别人好......以此逻辑推演,一个人的自信心会在很短的时间里爆棚,一个人的命运也常在同一时间转轨。
    27、迷恋赌博
    人皆有赌性,富于冒险精神的商人或许更甚。但敢冒风险和迷恋赌博是两回事。所谓小赌怡情,大赌乱性;赌性是一朵恶之花,一遇温床便奢靡开放,不加节制就可能毁掉一切。
    28、生活习惯不健康
    总是第二天开始锻炼,总是旅游的时候最累,总是一应酬就喝,一喝酒就醉,事业充满激情,身体充满疲惫......
    29、法制观念淡薄
    原因如下:一,有钱难道不能搞定一切?二,这事天知地知你知我知,怎会翻船?三,别人都这么干,我为什么不能?四,天啦,这点小事也算违法?
    30、武大郎开店
    不能容忍部下在某一方面比自己强,为了保持心理上的优越感和便于管理,喜欢招聘和使用不如自己的人。这类企业往往缺乏活力,在竞争中越来越难以胜出。
    31、漠视社会公德
    尊老爱幼,扶贫济困;遵守交通规则,维护公共秩序;不骄不躁不蛮横,节水节电节资源......今天,你忘记了吗?
    32、提着裤子找厕所
    做企业没有预见性,事到临头才忙找对策。具体表现在:不储备人才,不建立良好和谐的公共关系,不开发换代产品,不准备足够的现金流等。
    33、重业务轻财务
    民营企业老板大都是跑业务出身,或至少是很长时间战斗在企业营销第一线。这决定了他们的潜意识:市场是决定企业生存与发展的根本动力,当领导市场知识比财务知识更重要,搞管理销售报表比财务报表更诱人,做决策来自市场的调查数据比来自财务的预算核算更关键。
    34、个人表现主义
    在一个企业里,我才是红花,大家都是绿叶;在一个圈子里,我才是中心,大家都是配角——否则向内就会"怒从心中起,恶向胆边生";向外就会"全无兴趣,恕不奉陪"。其客观效果是,企业越做越难,圈子越扯越小。
    35、集团综合症
    据说现在全世界号称"集团"的公司加在一起,都没有中国多——几十上百万净资产的企业老板号称某某集团董事长的,在我们身边比比皆是。这是中国人虚张声势、不顾信用、好大喜功的企业化写照。
    36、速度幻觉症
    以个人的才能及工作绩效衡量所有人,以一个小团队的状态衡量全社会,从而误判投资回报周期,错估目标达成速度。
    37、企业掌控神经质
    很多老板常常疑神疑鬼,怀疑这个对他不忠,那个在干私活;怀疑这个在挖墙角,那个在磨洋工。一天到晚都认为他的下属总是向他隐瞒了什么东西。不信任副手,不信任合作伙伴,不信任财务,不信任采购人员,不信任基层员工。自己累,员工也累。
    38、会议综合症
    有事开会,无事也开会;大事开会,小事也开会。仿佛只有通过会议,老板和员工才能沟通,企业的控制才能实现,老板的意志才能贯彻。
    然而在很多企业,无效而过多的会议,已经构成它们最大的成本浪费。
    39、大企业形态小企业心态
    规模已经够大,心态依然很小:没有战略,缺乏人才,对员工能省则省,科研费用能推就推。本来已有大资本,偏偏又是土财主。因为来不及知道怎么做大企业,于是往往在堂皇外表下面露出留着泥巴的脚。一旦有风吹草动,那颗小小的心脏就会被庞大的身躯累死。
    40、营销唯一症
    企业的生死成败、资源重心,全压在市场营销一个环节上,一荣俱荣一损俱损。经验证明,这类企业即便超速成长也多如"塑料大棚",抗风险能力极其脆弱,风光三年以上者寥寥无几。
    41、制度管理教条主义
    生搬硬套西方企业理论,忽略中国企业本土文化背景,企业管理全盘西化、制度化、文本化。其结果是企业形态不伦不类、企业文化不洋不土、企业命运不生不死。
    42、管理幅度过大
    一项研究证明,一个人最多管十几个人,多了就会乱套,所以事事抓在手上不如建立一套规则把权力放下去,要不然累垮了自己,也拖垮了企业。
    43、形式主义借尸还魂
    二十年前打破铁饭碗,冲破形式主义而成长起来的民营企业家,随着企业规模扩大年岁增长,论资排辈日趋固化,等级制度日趋习惯,企业理念日趋模糊,企业文化日趋空洞——"百年钟馗变钟鬼",形式主义又回来了。
    44、缺乏民主
    制定了一大堆政策、制度,要求员工绝对执行,到了自己面前却一推再推;大会小会上严厉禁止种种不轨行径,一转身自己就成了最大的破坏者。
    45、野蛮管理
    其中比较容易想到的现象是:粗暴、打骂、体罚、限制人生自由等。比较不容易想到的现象是:从生活、言行、习惯、价值观等方面对员工做过度要求,甚至盲目实行企业军事化管理。这其中隐藏着现代商人必须唾弃封建观念:主宰等于权力,独裁等于效率。
    46、项目爱好癖
    唰,老板的眼睛放光了!嚯,老板的脸色出彩了!瞧,老板又开始行动了——肯定又在谈项目了。唉,我们公司去年谈了76个项目,落实了一个,至今都还在亏损。
    47、企业浮夸风
    浮夸风害死人,国家如此,企业也如此。很多企业家喜欢到处吹牛,一些所谓的企业家高峰论坛往往成了数字吹嘘论坛。同时,四处招兵买马,动辄搞跨越式发展,超常规跃进,几年之内要进入世界500强行列。久而久之,形势一片大好,老子天下第一,精神面貌饱满,从上到下陷入自我吹嘘自我满足的陷阱。
    48、合作伙伴同质化
    中国企业合伙常见病。一群相同气质爱好、能力水平、资源范围的理想主义者共同创业,上路之后才发现,一艘大船的远航既需要舵手,也需要水手,既需要懂天气的,也需要懂水文的......于是结构性失败在所难免。
    49、运动式管理
    一种典型的头痛医头脚痛医脚式管理。比如纪律不严明了,质量下滑了,营销不得力了,总是靠发动一场企业内部运动来突击解决。企业老板成消防队员,随时扑向失火的角落。最大的好处在于立竿见影;最大的坏处在于扰乱了企业经营的正常轨迹,透支了企业的人力物力财力。
    50、泛官僚化
    企业内从老板到管理者,每一个人都像计划经济体制下的干部,讲究程序、等级,习惯摆谱、弄权。此类现象严重的企业多半服务心态缺乏,学习能力欠缺,僵化保守直至竞争力丧失。
    51、主意太多,朝令夕改
    企业三天一小震,五天一大震,再强烈的信心也会全部震散,再优秀的团队也会茫然失措,再结实的建筑也会最终倒塌。
    52、忙而效率低下
    一个合理的建议是,立即停下你陀螺一样旋转的身体,去海边的沙滩晒着太阳理清以下问题:你的管理链条在哪一个环节开始打滑?你的企业动力是哪一个环节推而不动?哪些事情是必须做的,哪些不是?哪些事情是你应该做的,哪些是你应该授权别人做的?
    53、专家依赖症
    很多企业家对专家很迷信,事事以专家为准。但专家不是万能,他不可能对所有的事情都了如指掌,难免有局限,特别是在市场经验方面。所以,一旦过于迷信专家,往往会陷入教条化陷阱。
    54、好大喜功
    1000万的资金要盖70层的高楼;10岁的公司提出5年赶超世界500强的目标;30万身价的老板幻想着激动人心的远景,小项目不愿做大项目做不了......人性的弱点放在商人身上,其结局就更显悲壮。
    55、用胆而不用心
    中国的企业家从来不缺冒险精神,而是缺精益求精的精神。因此中国的企业从来不缺项目,而是缺把一个项目做到全世界无人能敌的专业精神、境界和才能。
    56、只追求有形利益
    换句话说就是只追求看得见的投入和产出,绝对的功利主义、实用主义和利润至上心态,有时候令企业丧失的不仅仅是形象,还包括企业的安全、长远的生命力等等。
    57、实事求是口头化
    民营企业"效率优先"、"一切按市场规律办事"是最大的实事求是。但很多企业真实的情况是"平衡优先","私欲优先",是"一切按照老板的喜好办事","一切按照长官的意志办事"......有人说,这是中国企业滑向"坏的市场经济"之前奏。
    58、外行管死内行
    企业雪球越滚越大,公司开始分隔为越来越多的精细领域,而每一个领域都需要相应的专业人才去加以管理。此时,创业者已经从原来的内行变成外行,但他仍然保持着内行的心态,用一竿子插到底的方式管理企业。很多时候,企业活力就这样慢慢窒息。
    59、习惯性摆阔
    前些年脖子上的金项链一个赛一个的粗,这些年屁股下的坐驾一个赛一个的牛;动辄"周末去巴黎购物",聚会永远聊高尔夫球场见闻......殊不知,面子害人,刻意要面子害死人:太工于摆阔的心计,往往让经营瞻前顾后;太重于摆阔的场面,往往让人生如履薄冰。
    60、形象即业务,豪华出效益
    一种肤浅的创业心态,加浪漫主义的创业形态。主要表现为:办公场地选高档写字楼,员工工资向大公司看齐,出差住四星级宾馆,请客上希尔顿酒店......最终的结果是,别人还没搞懂你的企业是干什么的,你的流动资金已开始告急。
    61、摸着石头过大江
    中国的民营企业早年习惯"摸着石头过小河",而今天他们要过的是大江,左有国有企业,右有外资公司,它们共同需要的都是现代化的帆船或者快艇。但也有经验主义者,想要"摸着石头过大江",其悲惨结局不问可知。
    62、用人才而藐视人才
    对于知识型人才,很多老板往往"既爱之,又恨之"。不得不用,却又从内心深处瞧不起他们,"百无一用是书生"的观念根深蒂固。因此在很多中国企业里,人才没有归宿感,老板没有放松感。
    63、朋友式管理
    在不少企业中,很多中干甚至高管都是和老板一起打天下的元老,碍于情面,老板不好将朋友和下属两种角色截然分开。最后导致老板没有权威,管理层相互较劲,员工无所适从,企业一片混乱。
    64、管而不理
    管是控制,理是训练;管是压力,理是疏导;管是条条框框中规中矩,理是苦口婆心指引成长。只管不理,企业不是在沉默中爆发,就是在沉默中灭亡。
    65、要么迷信媒体,要么藐视媒体
    前者最好的例子是秦池酒,盲目追求标王的媒体聚光效应,而终致惨败;后者的代表是德隆,由于不重视和媒体的沟通,结果企业一出事,全国媒体纷纷口诛笔伐,从而让企业的信任危机愈演愈烈。
    66、候鸟式投资
    这类投资者往往不愿意在一个行业里深耕,只愿意剥取最表面的一层机会,浅尝辄止。尽管投资常有回报,但企业总是做不大,一直在二三流企业的行列徘徊。
    67、碰壁拐弯习惯化
    一遇到困难,不对问题进行全面的分析,而是马上停止投资,调转方向另寻出路。这类投资者就像含羞草,一有风吹草动马上就缩成一团。这种看似谨慎的做法,往往却因不善于坚持而错过了真正的商业机会。
    68、假平等
    能干的下属是每个老板都梦寐以求的,但真的出现了能力出众的下属,老板往往又不能正确对待。为了维护表面上的平等,老板常常有意识地将机会让给其他员工,而把能干的人晾在一边。假平等的后果是,既增加了老板的机会成本,又挫伤了那些能力出众者的积极性。
    69、总是打精神牙祭
    在一些人看来这是惠而不费笼络人心的手段,是企业家不可缺少的画馅饼的才能。但现在的员工们已经越来越不相信它了,尤其当明天已经到来,"精神"并没有变"物质",而老板又在许诺后天的精神牙祭之时。
    70、企业激励货币化
    初衷是为了将公司做得规范,于是把各种激励政策完全货币化:加班给钱,提出好的建议给钱,互相帮助给钱,节约开支给钱......最后员工养成了习惯,做什么事情都要钱,甚至明明是自己分内的事,不给钱也不去做。
    71、以江湖气为荣
    耿直、爽快、兄弟多、与某某老大称兄道弟......在很多商人的心中,江湖形象和江湖背景,是一件比阅历背景、学历背景还要重要的事情。
    72、听喜不听忧
    只喜欢听员工汇报公司的正面消息,而不愿意听公司的负面情况。这是一种微妙的心理,一方面老板不愿意也不相信自己的企业会运作不佳,另一方面又害怕真的出事。最终的结果是人人报喜不报忧,中干会上歌舞升平,企业根基渐渐糜烂。
    73、创业情结挥之不去
    一家资产过亿的家电企业老板,大到人员招聘,小到办公室购买传真纸都要亲自过问,结果自己一天到晚疲惫不堪,而企业的发展也十分缓慢。这些多为创业型老板。他们对公司上上下下各个环节十分熟悉,对每一个员工甚至管理层都放心不下,总要亲自动手才踏实。
    74、盲目做全国市场
    想当然地认为只要做全国市场,各地销售额加起来肯定比在一个地方好。他们没有想到本来有限的精力一旦分散,更加不能和对手抗衡;而开拓全国市场,所需要的成本也比做地方市场要高出许多。
    75、强于演说而弱于倾听
    由于长期处于强势和核心地位,老板通常掌握了更多的话语权。这很容易让他们习惯性地表达自己的主张,而不注意倾听下属乃至朋友的意见。其实,上帝给了我们两只耳朵,一张嘴巴,就是暗示我们多倾听少定论。
    76、过分维护个人权威
    在员工面前永远一副冰冷的面孔,从来不在大众场合露出笑脸,说话喜欢用祈使语气,从来不主动和员工打招呼,有意识地和员工保持距离。
    77、装腔作势
    哎呀,胡总啊,来不了啊,今晚赵市长要请我吃饭,吃饭后电视台记者要来采访......哎呀,胡总啊,谁叫我们是兄弟呢,一定来一定来!市长的饭?不吃了不吃了,电视台也让他们明天再来......
    78、一利遮百丑
    片面追求利润,把现实的利润当成企业惟一重要的事情,不注重长期战略;一味压缩企业成本、降低员工待遇;忽视科研,不投入或少投入研发经费。老板应该注意对企业各个经营要素充分进行协调和平衡,这样企业才能长期持续健康地发展。
    79、盲目裁员
    一遇到困难,老板马上想到通过裁减员工来降低成本。盲目裁员,不但会挫伤员工的积极性,削弱员工对企业的归宿感,还会因为人员的流失造成企业的结构性紊乱。这一点上,不妨向日本一些企业学习:宁可降低工资也不裁员。
    80、一味模仿竞争对手
    永无创新,永远跟随:对手上一个新产品,自己马上跟进;对手在繁华路段开一个店,自己也跟着在附近开店;对手策划一个大型的公益性活动,自己也搞公益活动;对手提出一个新理念,自己马上也推出一个相同的理念。一味模仿竞争对手,看似贴身肉搏,实则很容易被对手扰乱了阵脚,被对手玩得团团转。
    81、自我反省能力差
    我们永远也不要低估人类追求创新追求真理的勇气和能力;但对人类固执己见坚持错误的"勇气"和"能力",恐怕同样也不能低估。
    82、权力控制欲
    极尽政治家才能,牢控企业每一个角落的权力不被流失——每一分钱的开支、每一个人的进出、每单生意的决策、每场会议的主持......此类习惯对小老板而言是美德,对大老板而言则是危机和病态。
    83、归罪于外
    企业利润下滑或经营不善时,总是习惯性地把问题归罪于外部因素,要么是政策环境不好,要么是对手卑劣,要么是行业不景气,要么是人才不足,而不从自身寻找原因。其实,任何时候,任何行业,总有赚钱的企业,关键还在于企业自身是否具有足够强的赢利能力。
    84、优柔寡断
    遇事不果断,前怕狼后怕虎,老在潜意识里想"这样做可能会有风险",结果把本来是自己的机会白白放过了。对待下属有争议的事情,也是左右摇摆,不知道该听谁的,结果被员工认为是"和蔼可欺",威信荡然无存。
    85、迷恋直觉
    崇尚"跟着感觉走",藐视基于市场调查的数据分析,认为决策没有什么理性可言,最可靠的反而是长期做市场过程中培养起的直觉。对于抗风险能力还不强的企业,一旦决策出现失误,就会带来灭顶之灾。
    86、产业投资步步高
    今天做食品加工,明天做酒店连锁,后天做网络科技,大后天做文化传媒。总之什么高端时髦搞什么,感觉越来越好,利润越来越少。
    87、假面认同
    开会之前,老板心里已经有了答案,但还是要大家畅所欲言,结果凡是与老板相左的意见全部被否定掉。久而久之,员工都明白这只不过是走过场,于是全部按照老板的意思去说。到最后表面上看起来所有的议题都得到了一致同意,但实际上都是老板自己的意见而已。
    88、零风险心态
    只想收获,不愿付出,不愿担风险,把所有的风险都转嫁到合作伙伴身上。最后发觉自己成了孤家寡人,谁都不愿意和他做生意。
    89、迷信高科技
    以为越是高科技的产品越能赚钱,于是不顾企业自身实际情况,凡是和高科技沾上边的项目都跟着投钱,盲目将产业"升级"。
    90、盲目进入资本市场
    企业发展到一定程度,就想着上市,以为这样企业才能发展得更好。事实上,企业一旦成为公众性公司,财务和重大决策都要透明化,老板个人对企业的影响将随之受到很大制约。上市流通并不是所有企业都需要。
    91、管理随意性
    这样的公司也有制度,但绝大多数时候都是"一切看着办"——好一点的情况是"一切以老板心中的是非判定为准",坏一点的情况是"一切以老板此时此刻的情绪为准"。
    92、节约到浪费
    节约是美德,节约甚至是一种精神及信念,是中国企业最核心的竞争力所在。但万事万物过犹不及,节约过头,则企业内事事打折扣,处处差把火,人才留不住,留人不留心......最后是效果出不来,效率上不去,投资收不回,节约等于浪费。
    93、以江湖手段解决企业竞争
    自以为企业背后有靠山,面对竞争对手,便每每"拳打脚踢"。要么强行要求对方退出地方市场,要么背地里给竞争对手的产品下套破坏其市场形象,要么联合某些政府部门三天两头上门"服务"。对手知趣便罢,否则便拳脚相加、大打出手。
    94、好了伤疤忘了痛
    企业遭遇困难的时候,三省其身,痛定思痛,誓言必革除种种弊端;一旦危机过去,又恢复了老样子,想当然地以为天下哪有这么巧的事情,同样的劫数肯定不会再发生了。
    95、有患难,无富贵
    笃信"人多好干活,人少好吃馍",对创业的功臣,既怕其功高震主,更惧其伸手要财。企业走上平稳发展的快车道之日,就是上演过河拆桥、卸磨杀驴之时。这种看似聪明的做法,往往只会带来"财散人散"的结局。
    96、同行之间妖魔化
    在同行之间挑拨离间,以为可以渔翁得利,却被揭穿谎言,落得里外不是人;或为竞争需要,乱说同行是非,惹来同行鱼死网破的反击,致全行业受损。
    97、独掌公司股权不放
    公司是自己辛辛苦苦创立起来的,凭什么要"白白分给其他人"?以为守住了金元宝,其实掉进了大陷阱。随着企业的壮大和社会分工的越来越细密,管理者在企业中的作用越来越大,他们必然不会满足于永远打工的地位。吸引部分管理者入股是大势所趋,既是企业长期稳定发展的基础,又是当代社会企业社会化的必然要求。
    98、人格分裂症
    极端的高尚和极端的卑劣并存,极端的向善和极端的无耻共生;愿意承担责任却又不断逃避责任,热爱有真理的世界却又时时制造虚假;对抗自私,却每天都在镜子里看到它。
    99、企业经营短期行为
    短期行为和长期行为的根本区别,在于一个经营者大多数时候,是在放弃品牌建设、制度建设、人力资源建设、核心竞争力打造等以获得眼前利益,还是相反。
    100、存小术,废大道
    一个企业要获得持续成长,企业家必须具备两种能力,一是应付各种复杂局面的能力和技巧,是为小术;二是立身社会、凝聚人才的信仰及人格魅力,是为大道。存小术而废大道,企业终究只是获小利而失根基。
     
    November 18

    宣传彩页

    November 17

    window live 照片上载控件下载解决方案

    photo Upload controlMSN照片上载控件点击无反应, 可是不装这个又没办法传照片... 郁闷之极

    我来为你解决,5分钟搞定.

    A: MSN Spaces上传控件[for IE6 or higher]一般是需要安装的 否则无法体验MSN Spaces和图片/相册等相关的内容
    解决办法: IE浏览器->Internet选项[Internet Options]->隐私[Privacy] Pop-up Block处点击设置[Settings]->填入spaces.msn.com->点击添加[Add]->点击关闭[Close]->点击确定[OK]

    你也可以直接不选中Pop-up Blocker处的Block pop-ups, 但是这样不安全 不建议使用.
    此时, 你重新登陆Spaces 应该可以安装上传控件了

    如果还是不行:

    可按照以下方法:IE浏览器->Internet选项[Internet Options]->安全[Security]->Internet->自定义[Custom Level]->ActiveX控件和插件[ActiveX Controls and plug-ins]->下载签名的ActiveX控件[Download Signed ActiveX]选择可用[Enable]或提醒[Prompt]->下载未签名的ActiveX控件[Download Unsigned ActiveX]选择可用[Enable]或提醒[Prompt]->运行ActiveX控件以及插件[Run ActiveX Controls and plug-ins]选择可用[Enable]->点击确定[OK]->点击确定[OK]
    此时, 你重新登陆Spaces 应该可以安装上传控件了

    公司终于成立了!!

    执著技术创新,构建智慧生活


    公司介绍

    西安安邦信息科技有限公司Xi’an Secoact Technologies Ltd.)致力于提供无缝计算、智能计算、安全计算、大规模计算和下一代网络计算的研究、开发、应用、生产、销售、技术咨询与客户培训等全面的解决方案。

    我们奉行“专业立身”的原则,我们的技术团队对所在领域拥有丰富的经验和深入的研究,从根本上保障了为用户提供有效、灵活、经济的应用方案的能力。

    我们秉持“客户至上”的理念,建立了强大的服务团队,为用户提供完善的售前、售后服务,承诺7x24的全天候垂询和下24小时响应的服务保障。 

    公司理念

    定位:立足长远发展,成长为全球领先的智慧计算解决方案提供商。

    愿景:执著技术创新,构建智慧生活。

    使命:聚焦客户关注的挑战和压力,提供有竞争力的智慧计算解决方案和服务,持续为客户创造最大价值。

    战略:以客户为中心,努力创新、持续沟通、坚持诚信、实现共赢。

     主营产品

          My Internet®安全移动系列产品

    MyInternet®安全移动IP技术

    伴随着因特网和移动通信的迅猛发展,IP网络和移动式设备数量呈爆炸式增长,越来越多的移动用户都希望能够以更加灵活的方式接入到因特网中去,而不受到时、空、接入媒体的限制。

    Internet工程任务组IETFInternet Engineering Task Force)综合考虑的各种可选方案的优缺点后,在原有IP协议的基础上提出了移动IP协议标准,主要包括RFC2002RFC2003RFC2004RFC2005RFC2006

    西安安邦信息科技有限公司经过深入研究和分析,对IETF移动IP技术标准进行了完善和发展,形成了自主创新的安全移动IP技术:MyInternet®MyInternet® 安全移动IP技术对传统的移动IP技术进行了多方面的优化和完善,为移动用户远程接入和机构间网络互联互通提供了高安全、高稳定、高效率、易管理、低成本的解决方案。MyInternet® 安全移动IP技术适用于政府、企业、能源、医药、电信运营、教育、科研等机构和行业。

    MyInternet®主要特点与性能:

    Ø       自由移动:移动终端不受时间、空间、接入媒体的限制,可在任意IP网络中移动;

    Ø       双向通信:移动终端移动到其他外地网络,总可以快速地被本地网络中的主机或其他移动终端找到,建立连接,实现真正的双向通信功能;

    Ø       应用透明:支持所有基于IP协议的网络应用,移动终端漫游到外地网络时,其网络应用的使用并不受到任何影响;

    Ø       拓扑透明:部署MyInternet®系统,对本地网络和外地网络没有特别的要求,部署后不会改变本地网络和外地网络的拓扑结构;

    Ø       IP地址不变性:移动终端始终保持其本地网络的IP地址,并使用它与其他终端通信;这一点对通过IP地址进行管理的网络应用尤为重要;

    Ø       高安全性:MyInternet®系统采用了多重安全保证,可以有效防止传输数据遭遇窃听、篡改、攻击等恶意网络隐患;

    Ø       高稳定性:MyInternet®系统采用了卓越的设计方案、充分的规模测试,为用户提供了无障碍永续运行的移动服务;

    Ø       高效能:MyInternet®系统为移动终端提供了迅捷的移动接入、快速的移动数据传输、即时的终端间网络交互;

    Ø       快速部署:MyInternet®系统基于最简网络模型设计,最大的加速了网络的部署速度;

    Ø       零管理成本:MyInternet®系统的稳定性、产品简单性、易配置性、智能性解决了产品的运行的免维护性,从而最大程度的降低了移动服务的管理成本。

    My Internet ® 产品与功能:

    Unicorn®系列 MyInternet®产品组成有:MyInternet®服务器、金虎符2006、安邦天翼2006、安邦控制台2006

    Unicorn®系列 MyInternet®系统网络拓扑

    MyInternet®服务器:是与移动终端家乡链路相连的核心网络设备,为每个移动终端提供注册、鉴权、通信、管理等服务功能,是MyInternet®安全移动IP技术的核心组成部分。产品以高强度工业控制机为平台,自主研发的操作系统为核心,先进的移动IP设计方案为指导,提供了高安全、高稳定、高速度、易管理的移动IP服务。

    金虎符2006:是一款集成MyInternet®安全移动IP技术的智能安全硬件产品,主要存储用户认证信息和移动IP的相关信息等,采用高强度加密算法,有效的保证了用户的接入安全。

    安邦天翼2006:是一款基于MyInternet®安全移动IP技术的智能安全客户端软件产品,是移动终端用户使用移动IP服务的窗口。安邦天翼2006通过金虎符2006获得用户认证信息和移动IP的相关信息,接入MyInternet®服务器,进行鉴权,然后通过高强度加密信道进行通信。

    安邦控制台2006:是一款移动IP服务的管理软件,主要用来完成金虎符2006的分发、授权以及MyInternet®服务器的系统管理等功能。

    Unicorn®系列 MyInternet® 服务器规格

    产品类型

    -----------------

    主要性能指标

    -------------------------------------

    安邦MIU50

    | 最多50个远程连接,转发速度40Mbps

    安邦MIU50F

    | 最多50个远程连接,转发速度60Mbps

    安邦MIU100

    | 最多100个远程连接,转发速度60Mbps

    安邦MIU100F

    | 最多100个远程连接,转发速度80Mbps

    安邦MIU300

    | 最多300个远程连接,转发速度80Mbps

    安邦MIU2000

    | 最多2000个远程连接,转发速度800Mbps

    ------------------------------------------------------

    移动用户远程访问企业内部网络解决方案

    在传统网络中,移动用户如果希望访问企业内部的网络资源,可以通过远程电话拨号接入企业的“远程接入服务器(RAS)”,这种方式往往需要企业支付较高的长途电话费用,而且网络速度慢,通信数据没有安全保障,也无法支持大量移动用户同时访问。同时,出差人员无法访问企业内部资源,企业内部人员也无法及时找到移动主机进行通信,给员工工作带来极大的不便,严重影响了工作效率。安邦科技MyInternet®安全移动IP技术为解决这一问题提供良好的解决方案,其解决方案如下图:<图看不见>

    企业运营网络资源解决方案

    许多企业从国外或国内购买了一些昂贵的网络资源,比如电子期刊、专业数据库等,但这些资源企业内部利用率不是很高,多数资源处于闲置状态。那么,企业可以考虑把这些资源出租或者有偿共享给其他企业或个人,以降低成本或者达到盈利的目的;当然,企业自身有很多有价值的网络资源,也可以出租或者有偿共享给其他企业或个人,从而使企业成为独立的网络服务提供商,达到运营的目的。安邦科技MyInternet®安全移动IP技术为企业要运营网络资源提供了一个安全、有效的解决方案。通过在运营企业部署安邦的MyInternet®服务器设备,在需要资源的企业或个人安装安邦天翼2006软件和配发金虎符2006,从而构建性价比非常高的资源运营网络。其解决方案如下图:<图看不见>

    企业总部与分支机构之间网络互联的解决方案

    许多大中型企业在全国各地都建有分支机构或者办事处,随着企业信息化程度的不断提高,一般在企业总部会部署如ERP 系统、OA 系统、邮件系统等应用软件,企业需要将分布在各地的分支机构和办事处与企业总部互联,达到安全地共享数据和软件资源的目的,采用传统的网络连接方式一般是租用专线,网络结构复杂和费用昂贵。MyInternet®安全移动IP技术为解决这一问题提供良好的解决方案,安邦科技为大中型企业设计了Unicorn®系列 MyInternet®解决方案见下图:<图还是看不见>

    公司联系方式:

    地址:中国西安市高新三路高科花园一期82501

    邮编:710075

    电话:86-029-88316253

    传真:86-029-88316253

    网站:http://www.secoact.com <尚未开通>

    邮箱:market@secoact.com

    June 16

    第一份网志

    生逢太平盛世,
    悠游青山碧波;
    疾志腾空万里,
    背负苍天宇廓.