Slashdot Mirror


Solaris Systems Programming

Ben Rockwood writes "UNIX, in all its many forms, was developed by developers for developers. This is evident in the connection between UNIX and C. In many ways, you can't truly understand one without the other. Certainly, there are plenty of UNIX users and admins who understand semaphores but have never written a threaded application, and C programmers who have never left the Windows world, but nevertheless at some point you'll encounter the symbiotic relationship the two share. Often, though, we find system administration books that discuss programming topics but not programming itself -- and conversely, C programming books that don't address the essence of UNIX. When we combine the two topics we get a systems programming book, an epic guide that clarifies relationships essential to understanding both entities in a truly holistic manner." Read on for Rockwood's review of Solaris Systems Programming, a book he describes as reaching this ideal. Solaris Systems Programming author Rich Teer pages 1248 publisher Prentice Hall PTR rating 10 reviewer Ben Rockwood ISBN 0201750392 summary Guide to systems programming using C on UNIX systems, not limited to Solaris

Several such guides have popped up over the years, such as The UNIX Programming Environment (Kernighan & Pike 84), Advanced UNIX Programming (Rochkind 85), The Magic Garden Explained (Goodheart & Cox 94), Advanced UNIX Programming (Gay 00) (that's not a typo, there really are two books with the same name), UNIX Systems Programming (Robbins & Robbins 03), UNIX Systems Programming for SVR4 (Curry 96), and the undisputed heavyweight champ, Advanced Programming in the UNIX Environment (Stevens 92).

Each of these books is distinctive, yet they share a number of topics. Essential topics include low- and high-level IO, signal handling, processes, IPC, and basic file system mechanics. In the more modern books, we see the inclusion of popular topics such as threading. Discussion directed toward broader topics of UNIX vary widely, namely due to the OS agnostic nature of such guides, despite the fact that until recently many books tended to slant toward SunOS/Solaris. Regardless of how many systems programming texts have appear, however, most programmers will agree that Stevens' guide is the only truly definitive choice. Since its release, there has been little challenge to its prominence, despite the emergence of Linux as a major UNIX implementation, despite several newer systems programming books, and even the 2nd edition of Rochkind's guide. But all of this now changes thanks to the release of Rich Teer's Solaris Systems Programming.

At a whopping 1248 pages, this volume dwarfs just about every systems programming book available by over 500 pages. It avoids the distractions of OS ambivalence by being tailored to Solaris, but is applicable to any UNIX platform available including Linux. Its layout is similar to that of Stevens' or Curry's books but builds significantly on each topic.

New systems programmers will immediately appreciate Teer's completeness, both in topic coverage and in his example code. Almost every code example is complete and runnable, unlike many of the other guides that demonstrate a topic only in an abstract function rather than complete program. Essential topics for completeness which have remained surprisingly absent from nearly every guide available (such as memory, code security and 64-bit topics) are thoroughly covered. A striking example is coverage of memory topics. When I pulled volume after volume off the shelf of my local bookstore and looked up "memory" in the index of each, I found surprisingly few even cover the topic beyond explaining the difference between stack and heap. In fact, many don't even include the malloc() function. Solaris Systems Programming is the only book I've ever found so complete in its memory discussion that it not only covered stack and heap, all the available memory management functions, but even discusses such important topics as memory alignment!

A complete chapter on secure C programming is provided, thoroughly discussing such important topics as buffer overflows, chroot jails, and program environment. A good number of tips are provided to help you immediately incorporate better security into your app whether it's a real concern (for now) or not. Combine this with a complete chapter on resource control and limits, including discussions on system information, the /proc file system, and some Solaris-specific resource control facilities, you can write more intelligent, less obtrusive, and better-tuned applications.

The coverage of advanced IO topics (including STREAMS) and file system coverage are superior to that in any other text I've seen. System admins will appreciate the in-depth coverage of file system topics that have only seen this sort of detail in books such as Solaris Internals (Mauro & McDougall, 00). This level of discussion allows not only a better understanding of file system and IO techniques, but also the clarity to immediately start building your own tools that allow you to interact with file system with far greater precision than ever before. Other topics, such as memory mapped IO, have rarely seen such detailed coverage.

A full treatment of IPC topics are handled, but like Stevens', these techniques are discussed using conventional concurrency techniques such as fork(). A discussion of POSIX threading is absent and regarded as too large a topic to address properly in a systems programming book and the reader is urged to consult a complete guide to the topic such as Programming with POSIX Threads (Butenhof, 97). While some readers might be put off by this, you'll appreciate how this keeps IPC discussions unencumbered. POSIX threading is mentioned where applicable, so it's not at all ignored, but readers of Rochkind's 2nd Edition or Robbins' books will notice that introduction of a PThreads overview can quickly overwhelm the rest of the text. Unique to any other text with which I am familiar is the inclusion of a section on Solaris Doors (also applicable to the Linux implementation), which is the fastest IPC method in Solaris, introduced with Solaris 2.6.

Something that both new and seasoned programmers will appreciate is the inclusion of a chapter on utility functions, and another on localization. The utility chapter provides great a discussion of (and reference to) the often-used functions that many other books ignore, such as string handling and manipulation functions, memory management, byte arrays, temporary files, error reporting, command-line argument parsing, character classes and more. While it's true that these aren't strictly systems programming topics, they are inevitably going to be topics of interest to most programmers. It is the inclusion of such topics that allows you to take your pile of reference books and replace it with this single volume.

A major topic to systems programmers today is 64-bit programming. Naturally, Solaris is a robust 64-bit environment, and is well handled in this book. programmers new to 64-bit environments, whether on Linux, Solaris, or other UNIX platforms, will greatly appreciate the gentle introduction to 64-bit coding, as well as best-practice techniques and sprinkled 64-bit wisdom throughout the text.

Like it or not, Solaris is the dominant commercial UNIX platform in the market today and will be for the foreseeable future. This guide doesn't pull any punches in giving you the best information available to exploit that environment to its full potential. If you're a programmer, this book gives you a single reference to consolidate your library and give you a new appreciation for familiar topics and entry point to things that you might have never leveraged before (Doors, 64-bit optimization, etc). If you're a system admin, you'll find a whole new appreciation for Solaris and UNIX in general with unparalleled understanding of how they really work under the covers, especially if you've already read Solaris Internals. Everyone will love the detail and completeness, combined with with the hundreds of tips (not to mention nifty Solaris trivia) scattered throughout the book. Rich's style is compelling and relaxed, very readable in front of your keyboard or with a cup of coffee on the porch. And readers will enjoy his sense of humor, which is admittedly subtle; experienced programmers and system admins, though, will enjoy the book's wit.

Finally, given the impending release of Solaris 10, yet another aspect of this book needs to be considered: it's an essential companion for DTrace users! Rich couldn't have possibly foreseen this need when he started writing the book, but it is extremely important today. Solaris 10 provides more visibility and debugging tools than any other UNIX system in existence today, the most popular of which is DTrace. But all of these tools expect the user to have a certain level of understanding of the system itself. This book should be standard issue for any sysadmin that ever plays with Solaris 10. When doing system root-cause analysis with DTrace, this book becomes an essential reference, especially if you are allergic to system headers. If you have been using DTrace and getting lost, or feel that you just don't know Solaris the way you need to, buy this book and you'll find the confidence and skills to get you back on track.

You can learn more about Solaris Systems Programming on Rich Teer's home page for the book. On that page the full contents and index are available, including a sample chapter (Ch 8 "System Information and Resource Limits," 62 pages!). You can also visit Teer's personal home page to learn more about him and his work. You can purchase Solaris Systems Programming from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

181 comments

  1. Dougla Adams by Anonymous Coward · · Score: 5, Funny

    Am I the only one that can't read the word holistic without thinking about electric monks on horses?

    1. Re:Dougla Adams by spuzzzzzzz · · Score: 1

      I tend to think more of lost cats in Bermuda, personally.

      --

      Don't you hate meta-sigs?
  2. 6 year old view of the computer world by Rosco+P.+Coltrane · · Score: 1, Interesting

    Certainly, there are plenty of UNIX users and admins who understand semaphores but have never written a threaded application, and C programmers who have never left the Windows world,

    Newsflash: Windows implements IPC mechanisms. You know, like all modern multitasking OSes?

    Other newsflash: C programmers can be found under Windows, Unix, MacOS10, BeOS, GEM, ThingamabobOS... In fact, real professional programmers can program in anything under any environment, they just happen to be a bit more proficient under certain kinds of environments.

    --
    "A door is what a dog is perpetually on the wrong side of" - Ogden Nash
    1. Re:6 year old view of the computer world by agent+dero · · Score: 3, Informative

      Third newsflash: there are many things that you can only really do with C on Unix systems, POSIX anybody?

      --
      Error 407 - No creative sig found
    2. Re:6 year old view of the computer world by Kiryat+Malachi · · Score: 3, Insightful

      There are many things you can only do with C compiled directly to the core on an embedded system, effectively writing your own OS. This does not make programming to the raw iron any better than UNIX or even Windows, just different.

      --

      ---
      Mod me down, you fucking twits. Go ahead. I dare you.
      (I read with sigs off.)
    3. Re:6 year old view of the computer world by noselasd · · Score: 0

      What about it ? services for unix from MS contains a posix subsystem, and we have cygwin.

    4. Re:6 year old view of the computer world by Rosco+P.+Coltrane · · Score: 3, Informative

      Don't mix C and libraries. C is C, the core of the language is so small its list of reserved keywords fits on a half sheet of paper, and the rest isn't much bigger.

      Whatever useful you can do on top of C depends on whatever libraries you slap on top of it, that gives you, the programmer, easy access to various abstractions of whatever the OS offers you. conio for example reflects what DOS and the BIOS can do and doesn't exist (originally) in Unix. Some libs are common though, like stdio and stdlib. Those are said to be portable, but they're still not part of the C language per se.

      The core of the C la

      --
      "A door is what a dog is perpetually on the wrong side of" - Ogden Nash
    5. Re:6 year old view of the computer world by ProfaneBaby · · Score: 1

      You do know that Windows implements quite a few portions of POSIX, right?

      Link

      --
      Video Phone Blogs send video messages straight to the web.
    6. Re:6 year old view of the computer world by Anonymous Coward · · Score: 0

      How is this a newsflash, and what does it have to do with anything? He never said windows didn't have IPC, and he already said in the quote you are replying to that C programmers can be found under windows. With useless posts like this, you certainly live up to your namesake.

    7. Re:6 year old view of the computer world by Anonymous Coward · · Score: 0

      > Third newsflash: there are many things that you can only really do with C on Unix systems, POSIX anybody?

      What do you mean by "do POSIX"? Do you mean write portable programs that will compile on any POSIX-compliant system? Many languages can do that.

    8. Re:6 year old view of the computer world by Charvak · · Score: 1

      That system is broken and useless for writing useful program. The posix subsystems support the minimal posix standard and microsoft implemented this because at that time goverment computer were supposed to be posix compilant.

    9. Re:6 year old view of the computer world by photon317 · · Score: 2, Informative


      stdio/stdlib aren't really libraries, they're just header files. The technical distinction you're looking for is actually between 4 things:

      1) The C language (the half page of reserved keywords you mentioned - you get no header files with this (I don't think?))

      2) "Standard C" or "The Standard C Library", which now comes in two major flavors - C89 and C99. This is all those headers like stdlib.h and stdio.h. This is an official standard, and barring a few isolated compilers made for specialized embedded systems that might support the core C syntax but not the Standard C environment, almost all remotely modern C compiler environments support "Standard C" (aka ISO C, aka ANSI C, whatever...).

      3) POSIX, which comes in a few different levels, flavors, and revisions. POSIX builds on top of Standard C and adds a few more portable things. Most OSes support the vast majority of POSIX, and they'll usually document somewhere what parts of POSIX they're conformant with to what degree. Related to POSIX are several other standards and pseudo-standards that are more unix-centric than POSIX (POSIX is quite unixy in its nature, but it also focuses on being as OS-neutral as it can) with names like SUS (Single Unix Standard), X/OPEN, SVR4, BSD, SVID, Unix98, etc... Many of them overlap (and sometimes contradict) the areas that POSIX and Standard C cover, and many unixes support some set of those standards to some degree.

      4) Other libraries... this is where you branch out into all the millions of libraries that may or may not exist on various systems and may or may not be covered by their own standards.

      --
      11*43+456^2
    10. Re:6 year old view of the computer world by gatkinso · · Score: 1

      It is true - but the POSIX subsystem is a paltry subset of the full POSIX standard, sits on top of Win32, and (I think) deprecated.

      --
      I am very small, utmostly microscopic.
    11. Re:6 year old view of the computer world by cerberusti · · Score: 1

      Yes, but Windows implements them poorly. There are many areas of it that do not work correctly, behave in a slightly different way than the spec says, or take different parameters. I ended up writing a library controlled by an #ifdef to call my own version of the POSIX functions which are implemented directly in the win32 API. Believe it or not, it is actually much easier that way (although I do have to implement every POSIX function the first time I use it) this retains the normal portability of POSIX, it just handles Windows as a special case. POSIX as Windows does it is horrible though.

      --
      I'm a signature virus. Please copy me to your signature so I can replicate.
    12. Re:6 year old view of the computer world by be-fan · · Score: 2, Informative

      It's quite possible to bind POSIX to any language. Many Lisps can natively call C API using the platform's C calling convention.

      --
      A deep unwavering belief is a sure sign you're missing something...
    13. Re:6 year old view of the computer world by Bush+Pig · · Score: 1

      stdio and stdlib _are_ really libraries. Just because the standard requires them doesn't imply that they are part of the language. They aren't. They're libraries, and you're quite at liberty to replace them with your own libraries that do the same sorts of things. Btw, I've been programming in C for about 15 years.

      --
      What a long, strange trip it's been.
    14. Re:6 year old view of the computer world by v01d · · Score: 1

      Btw, I've been programming in C for about 15 years.

      So? The language specification includes a standard library of functions. Stdio and stdlib are the declarations for specific functions and types found in the C library. To be called an ANSI C compiler your compiler must provide access to things like printf.

    15. Re:6 year old view of the computer world by Moderatbastard · · Score: 0
      ---
      Mod me down, you fucking twits. Go ahead. I dare you.
      (I read with sigs off.)
      I'm glad I don't. Tell it how it is, don't hold back now! I totally agree, FWIW.
      --
      1/3 of jokes get modded OT. If you get the joke, mod 1 in 3 insightful/interesting/underrated to restore karma balance.
    16. Re:6 year old view of the computer world by Korpo · · Score: 1

      Isn't the opposite true?

      POSIX in WinNT doesn't sit on Win32, and vice versa, they are two execution engines on top the kernel.

      Of course, MS POSIX is just a facade to get DARPA approval, and is not maintained very much. And it is slow compared to Win32.

      If Windows had a real POSIX implementation, why would you need Services for UNIX from MS to turn it in a more UNIX-like box (with lots of BSD code)?

      At least, IIRC.

    17. Re:6 year old view of the computer world by Kiryat+Malachi · · Score: 1

      Hey, I have karma to burn. Mod me however the fuck they want, I'll still be right, and they'll still be twits.

      --

      ---
      Mod me down, you fucking twits. Go ahead. I dare you.
      (I read with sigs off.)
    18. Re:6 year old view of the computer world by gatkinso · · Score: 1

      Well, as usual, truth rarely fits into simple little statements like the one I made.

      True, the POSIX subsystem doesn't sit solely on top if Win32 - however many of its calls are translated to Win32 calls and passes to the NT Executive. I believe the same is true for the OS/2 subsystem.

      However with Services for Unix 3.5 much of this could be changed.

      http://www.microsoft.com/technet/prodtechnol/win nt as/evaluate/featfunc/ntfndtn.mspx

      --
      I am very small, utmostly microscopic.
    19. Re:6 year old view of the computer world by photon317 · · Score: 1


      Sorry for the late reply, I do that a lot.

      You're not really disagreeing with me here. I agree that they are not a part of the C Language, but they are a part of the established ISO/ANSI Standard known as "Standard C" aka "ANSI C", and therefore they are required for all implementations which conform to this standard. And stdio and stdlib are just the names of the header files which contain certain functions from the Standard C library specification. There is no requirement that they represent actual library names. Most commonly the functions specified in the stdio and stdlib header are both contain in a library which is actually called "libc".

      --
      11*43+456^2
  3. In other news by thammoud · · Score: 5, Funny

    Amzon has a great deal on a new book released by O'Reilly. Programming the 8080 in assembler.

    1. Re:In other news by ariels · · Score: 1

      Assembler? Luxury! We had to program an SDK-85 (made by Sintel, perhaps?) on a hex keypad in machine code, which we assembled in 2 passes by hand on a piece of paper!

      The sad thing is it really happened, and I still remember leaving NOPs to make debugging changes easier...

      --
      2 dashes and a space, or just 2 dashes?
  4. Typo by Rui+Lopes · · Score: 0, Flamebait

    Actually, the number of typos are two:

    Advanced UNIX Programming (Gay 00) (that's not a typo, [...])

    I mean, who has "Gay" in the name?

    --
    var sig = function() { sig(); }
    1. Re:Typo by Timesprout · · Score: 3, Funny

      Big Gay Al

      --
      Do not try to read the dupe, thats impossible. Instead, only try to realize the truth
      What truth?
      There is no dupe
    2. Re:Typo by multipartmixed · · Score: 1

      > I mean, who has "Gay" in the name?

      There is a law firm in town named "Gay and Associates".

      I almost pissed myself laughing one day when I had to drop some papers off there.

      --

      Do daemons dream of electric sleep()?
    3. Re:Typo by neonstz · · Score: 1
      I mean, who has "Gay" in the name?
      Gaylene Pron has.
    4. Re:Typo by Anonymous Coward · · Score: 0

      Here is such a person:

      http://www.larazon.com.ar/diario_lr/2003/05/29/3 -5 66896.htm

    5. Re:Typo by Anonymous Coward · · Score: 0

      Mount Gay Rum, is it a beverage or an invitation?

    6. Re:Typo by Bush+Pig · · Score: 1

      This reminds me of a joke (which may only be accessable to English and Australian people).

      Q. What's the naval equivalent of wine, women and song?

      A. Rum, bum and gramophone records.

      Boom, boom!

      --
      What a long, strange trip it's been.
    7. Re:Typo by abionnnn · · Score: 0

      Yep, that's a cracker that one ;)

  5. Comment removed by account_deleted · · Score: 2, Informative

    Comment removed based on user account deletion

  6. The relationship between C and UNIX... by Realistic_Dragon · · Score: 5, Funny

    ...is like the relationship between Petrol and a Car.

    You can put a monkey in a car and they might dent it, pee on it, scratch it... but it'll carry on (mostly) working. Let the monkey lose with Petrol and the whole damn thing is going to blow and some poor sod will lose their eyebrows.

    --
    Beep beep.
    1. Re:The relationship between C and UNIX... by Timesprout · · Score: 0

      Strangest analogy ever.

      --
      Do not try to read the dupe, thats impossible. Instead, only try to realize the truth
      What truth?
      There is no dupe
    2. Re:The relationship between C and UNIX... by Aroma+7herapy · · Score: 1

      Yeah like last night; my monkey, when trying to build his first "Hello World", blew up his machine. *again*

    3. Re:The relationship between C and UNIX... by RAMMS+EIN · · Score: 1

      ``Let the monkey lose with Petrol''

      You mean like the Micromonkey?

      --
      Please correct me if I got my facts wrong.
    4. Re:The relationship between C and UNIX... by secolactico · · Score: 1

      Man, you gotta cut back on your FARK intake.

      --
      No sig
  7. fork() is a cheap operation on unix by Anonymous Coward · · Score: 0

    so what is advantage of threading? (instead of fork)
    why did apache 2.0 use threads? 1.3 is very, very fast already...

    1. Re:fork() is a cheap operation on unix by Anonymous Coward · · Score: 0

      Um. A fork requires the copying of all data from the parent's execution environment.
      Threading does not.

    2. Re:fork() is a cheap operation on unix by temojen · · Score: 1

      Faster inter-thread communication, and only needing to mmap files once.

    3. Re:fork() is a cheap operation on unix by RAMMS+EIN · · Score: 4, Informative

      ``fork() is a cheap operation on unix so what is advantage of threading?''

      Guess what? Typical UNIX software doesn't use threading. Forking is much easier, was there first, and is usually not significantly less efficient.

      ``why did apache 2.0 use threads?''

      Probably because it runs on systems that don't have cheap forking (like Windows). Besides, IIRC threading is only one of the mechanisms that apache2 can use, and you can use forking if that suits you better.

      --
      Please correct me if I got my facts wrong.
    4. Re:fork() is a cheap operation on unix by AuMatar · · Score: 2, Informative

      Not quite. COW: copy on write. Basicly you use the same physical page in both processes, until one or the other makes a write to that page. Then and only then do you make a copy.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    5. Re:fork() is a cheap operation on unix by Anonymous Coward · · Score: 0

      on NT kernels u can have FIBERS or Lightweight Threads where you can take COMPLETE CONTROL over CONTEXT SWITCHING and everything if you want that kinda stuff for real serious solutions.

    6. Re:fork() is a cheap operation on unix by AuMatar · · Score: 4, Informative

      Easy access to shared variables. If you fork, each process gets their own copy of a variable. An update by process A does not propogate to process B. This is a two sides issue, as it also makes race conditions possible if you don't protect data structures correctly. Of course, you can use shared memory, but thats more of a hassle to set up.

      The other advantage is task switching speed. When switchign between applications (such as forked processes), you need to do a full task switch- registers, stack, memory, cache invalidate, etc. Very expensive. When switching between threads you only need to swap out the registers, stack, and program counter. Very cheap.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    7. Re:fork() is a cheap operation on unix by AlexEdwards · · Score: 1

      In an ideal (simple) software implementation fork() is cheap. However, try running a few thousand simultaneous, long-running connections to an Apache 1.x server (and mod_xxx extensions) and see it grind on a moderate machine - if it even gets that far (say, 15MB per process with a memory-tuned mod_perl). A fully-functional, threaded java-based server will get there with ease, and probably Apache 2.x too. See the real-time, multipart mime Chart on our website for an example.

      --

      Galmarley - Free research on economic hi

    8. Re:fork() is a cheap operation on unix by Chirs · · Score: 1

      Just a quick comment. With linux, the clone() syscall lets you create a new child with the ability to specify at a very fine-grained level what you want to share. File descriptors, memory map, signal handlers, etc. can all be specified separately.

      Then, in the scheduler it is smart enough to consider how much is actually being shared between the old task and the new task, and switch only the bits that actually need it. Plus, since processes in linux are very light weight, there isn't actually that much difference switching between threads in the same process and threads in different processes.

      If you read "The Art of UNIX Programming", threads are considered the last resort if no other IPC mechanism is fast enough. This is an extremely rare occurrence. Separate processes with specific areas of shared memory is almost always sufficient, and far less likely to cause problems.

    9. Re:fork() is a cheap operation on unix by KenSeymour · · Score: 3, Insightful

      I think it is a culture thing. For a long time, Unix thread code didn't port.
      Some flavors didn't even have threads.
      So if you wanted to write a product that worked on multiple Unix variants, you used forking and IPC instead of threading.
      It took a long time for pthreads to catch on.

      Windows programmers generally don't worry about porting so they took to threads more quickly.

      --
      "We can't solve problems by using the same kind of thinking we used when we created them." -- Albert Einstein
    10. Re:fork() is a cheap operation on unix by Guy+Harris · · Score: 1
      When switchign between applications (such as forked processes), you need to do a full task switch- registers, stack, memory, cache invalidate, etc. Very expensive. When switching between threads you only need to swap out the registers, stack, and program counter.

      I'm not sure what you mean by "memory" in the full task switch list. I suspect you mean "address space"; swapping that could be expensive if, for example, you have to invalidate a TLB and re-populate it.

      If by "cache invalidate" you mean invalidate the caches that sit between the CPU and main memory, that might not be necessary if, for example, the cache is physically indexed and tagged - and possibly not even if it's virtually indexed if, for example, it's physically tagged.

      So, while there is a cost to process switching if it involves address-space switching, it's not necessarily as large as you might think.

    11. Re:fork() is a cheap operation on unix by AuMatar · · Score: 1

      Yes, by memory I mean address space. Which generally means invalidating TLBs and switching page tables (and on some systems like x86, possibly paging in the page tables).

      Yes, by cache invalidate I meant the cache between the CPU and memory. I'm at work, so I can't really check sources, but IIRC there's a lot of cases where cache and its associated buffers need to be invalidated. Possibly not all, I won't pretend to be on the cutting edge of that stuff.

      At any rate, the basics is- process switching between 2 threads is very cheap, switching between two processes is more expensive. The exact ratio between the two depending on a lot of factors. It is still an advantage for threaded apps, wether you need that advantage or not depends on the application.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    12. Re:fork() is a cheap operation on unix by Tet · · Score: 2, Insightful
      Of course, you can use shared memory, but thats more of a hassle to set up.

      Perhaps. But it's also far less error prone than threads sharing variables when one thread forgets to get its locks right. That in turn leads to more reliable and stable software, and is generally considered a better model. With mmap/MAP_SHARED, you have to explicitly reference the data you wish to share, so the programmer tends to think more about what they're doing. With threads, everything is shared by default, and it's much easier to overlook the fact that another thread might be using that data.

      --
      "The invisible and the non-existent look very much alike." -- Delos B. McKown
    13. Re:fork() is a cheap operation on unix by Anonymous Coward · · Score: 1, Informative

      well for one threads have shared memory so communication is simply reading/writing a globally protected variable.

      not to mention that most (not linux, until very recently) have a kernel level threads, which can map n-to-m to user-space threads. that means when some app creates some number of threads n, that they may only be backed by m real context executions within the kernel. this is a major advantage over forking. if you need a thread for just I/O where an execution context isn't required, it's much lighter weight than creating an entirely new process.

      if you don't know why threads are better than creating processes, then you should read a good intro to threads. I'd suggest one that talks about solaris threads or the linx ntpl threads.

    14. Re:fork() is a cheap operation on unix by Charvak · · Score: 1

      yeah but in fork you still have to create and copy the page table. In thread you dont. Also context switching is cheaper for threads than process.

    15. Re:fork() is a cheap operation on unix by 12357bd · · Score: 1

      The dicothomy netween processes and threads is false/religious/historical/etc, just use the right tool for the job, that's all.

      --
      What's in a sig?
    16. Re:fork() is a cheap operation on unix by swillden · · Score: 2, Funny

      Windows programmers generally don't worry about porting so they took to threads more quickly.

      Whaddaya mean Windows programmers don't worry about porting? I've seen *lots* of Windows programs that boast about their portability.

      They run on Windows 95, Windows 98, Windows 98SE, Windows ME, Window NT 3.5, Windows NT 3.51, Windows NT 4.0, Windows 2000, Windows 2000 SP1, Windows 2000 SP2, Windows XP...

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    17. Re:fork() is a cheap operation on unix by swillden · · Score: 1

      yeah but in fork you still have to create and copy the page table.

      Not true for clone() in Linux. clone() is really an elegant solution to the whole problem; it's just fork() (which is very easy to work with) with fine-grained control over how much the current and new processes share (you can't call them parent and child, because clone() allows a process to create siblings, not just children).

      But, of course, if you need portability and don't want to suffer the (small but non-trivial) overhead of fork(), then you need to use pthreads. They're also not that tough to work with, but are less elegant and less flexible than clone().

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    18. Re:fork() is a cheap operation on unix by Charvak · · Score: 1

      Since I dont know about the clone(), I cant comment but all unix os have a vfork which does not create a new page table. The idea is that user will immediately do the exec after the vfork.
      Is clone() the clone of vfork in linux ? (Pun intended)

    19. Re:fork() is a cheap operation on unix by onta · · Score: 1

      IIRC Solaris has switched to an 1-1 threading model by default in its latest version. And also IIRC, linux has had a 1-1 model all this time because Linus thought it was good enough and way simpler than a n-m model.

    20. Re:fork() is a cheap operation on unix by swillden · · Score: 2, Informative

      Is clone() the clone of vfork in linux ? (Pun intended)

      :-)

      Actually vfork(), as defined by POSIX at least, doesn't create a child with a shared memory space, exactly. Well, maybe it does, but you're not supposed to use the memory. In a POSIX program you're not supposed to modify any memory in a vforked child (behavior is undefined if you do). The only purpose of vfork() is to avoid wasting time copying all of the page tables immediately before calling exec(), which will replace the whole current process anyway.

      I wouldn't be surprised if there are some implementations of vfork that do act like Linux clone() with the CLONE_VM flag, but you can't portably depend on that behavior (of course you can't portably depend on clone() at all).

      On Linux, vfork() is a special case of clone().

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    21. Re:fork() is a cheap operation on unix by Tough+Love · · Score: 1

      IIRC, linux has had a 1-1 model all this time because Linus thought it was good enough and way simpler than a n-m model.

      And because of that, Ingo Molnar developed the O(1) scheduler which make the 1-1 model perfectly efficient. Linux also has the clone system call which lets you share whatever you want to share, including process memory.

      With these improvements, PThreads are now inferior for anything except porting code. Oh, and PThreads provides its own mutexes, which are pretty much obsoleted by Linux's new futexes that have the advantage of not being specific to PThreads.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    22. Re:fork() is a cheap operation on unix by Pseudonym · · Score: 3, Insightful
      Guess what? Typical UNIX software doesn't use threading. Forking is much easier, was there first, and is usually not significantly less efficient.

      It depends what you call "typical".

      A web server generally doesn't need shared data. Apache 1.x only uses shared data for a small amount of statistics gathering/monitoring, which is a very small amount of work compared with the job of actually serving HTTP, so the minor overhead in managing the shared data doesn't hurt very muvh at all.

      The same applies to other kinds of server where little or no synchronisation is needed (e.g. telnet server, ftp server, ssh server).

      At the other end of the spectrum is a program which does need synchronisation, but each request/response is quick. An X server is a good example. In this case, a single-task tight event loop architecture is appropriate.

      And in the middle, you have a lot of jobs which aren't so simple. A typical DBMS is a good example of this. You have multiple concurrent tasks, which may take an unbounded amount of time, and which may require a nontrivial amount of synchronisation. The jobs aren't effectively sequential, meaning that SMP scalability is possible, but they're not completely isolated either. This is the kind of task where multi-threading is almost always the right answer.

      Multi-threading is also commonly found in interactive GUI applications, where there may be long background tasks in conjunction with low-latency requirements.

      So while it's true to say that typical Unix software, in the sense of most software that comes packaged on the CD from your vendor, is not multi-threaded, that's because most of that software doesn't have difficult synchronisation or scalability problems to solve. On the other hand, a lot of the software that you might buy or obtain after that is indeed multi-threaded.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    23. Re:fork() is a cheap operation on unix by Pseudonym · · Score: 1
      If you read "The Art of UNIX Programming", threads are considered the last resort if no other IPC mechanism is fast enough.

      If you read that book, you will find that the author is heavily biassed against threads. You get the impression that he's never had to solve a difficult synchronisation/scalability problem in his life.

      Not that there's anything wrong with that. Threads are inappropriate for a lot of tasks, and if your programming career isn't very varied (from a concurrency point of view!) you may never come across a problem for which threads are the best answer. On the other hand, there are some problems for which they're the only practical answer. Being able to see which is which before you start coding is part of being a good developer.

      Threads get a bad rap for two main reasons:

      1. Some novice developers use threads when they're not the best solution. (And sometimes non-novices do, too. If you come from a non-Unix background, for example, you may not be used to fork().)
      2. Threads are most useful for solving hard problems, and critics mistakenly point to the necessary complexity in the solution and say it's due to threads.

      The last point is the most unfair. The concurrency problems in writing a typical DMBS or a typical GUI web browser would be just as tricky to solve with fork() than with threads (possibly even trickier, which is, no doubt, why fork() isn't used for these jobs).

      Just saying "threads are bad, m'kay" cheats you and your users out of a good solution to many problems which turn up in practice.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    24. Re:fork() is a cheap operation on unix by adamruck · · Score: 1

      threading is considered to be more lightweight, using less memory, which is a good thing for servers with heavy loads. In reality not all threading implementations are really lightweight though(ex perl ithreads)

      the nicest part about programming in threads is the ability to share data without having to do crazy ipc stuff. This is used alot in servers, one client connects, changes the state of the server slightly, and the other clients and admin want to know what happened.

      --
      Selling software wont make you money, selling a service will.
    25. Re:fork() is a cheap operation on unix by boots@work · · Score: 1

      So creating a thread that immediately exits is faster than creating a process that immediately exits. Woo-hoo.

      A more interesting case is if they keep running together. In the thread, everything is shared: there must be a locks on the heap to synchronize access, so you pay a price on every malloc and free[*]. (It should not be necessary to point out that these are far more common than creating threads.) There are similar issues for per-process in-kernel structures such as the file table. Because more data is shared, there is more likely to be contention between threads from the same process on different CPUs.

      Some of tridge's benchmarks show that on $vendor Unix, using threads can be twice as slow for a server-side tasks as using processes. On Linux, threads are only slightly slower.

      Shared-everything is often a slower model, not faster.

      [*] OK, it doesn't have to be a lock, but the heap does have to be thread-safe, which makes it slower or more complex or both.

    26. Re:fork() is a cheap operation on unix by boots@work · · Score: 1

      I agree.

      The guy above saying that threads are faster to create because of page table copying is completely missing both the good and bad points of threads.

    27. Re:fork() is a cheap operation on unix by 12357bd · · Score: 1

      If you read "The Art of UNIX Programming", threads are considered the last resort if no other IPC mechanism is fast enough.

      That's only because the book's author never have to deal with scenarios where threads are the logical solution, ie graphical interfaces.
      Don't take me wrong the book is great and after too many years of experience, I still subcribe almost 90% of the views expressed on the book, but the 'unix only' background/bias of the author is evident.
      As for threads or processes, just use the right tool for the job, there are no magic rules.

      --
      What's in a sig?
    28. Re:fork() is a cheap operation on unix by mikefe · · Score: 1

      Yes, I know it was a joke. But...

      All of those versions listed have threading.

      --
      There: Something at a specific location.
      Their: Owned by someone.
      Please make sure your english compiles.
    29. Re:fork() is a cheap operation on unix by eraserewind · · Score: 1

      This got a funny mod, but those OS (or OS versions if you prefer) represent a huge percentage of the market out there.

    30. Re:fork() is a cheap operation on unix by Anonymous Coward · · Score: 0

      As usual I see a bunch of 15-year old americans spouting crap about Unix programming, without actually backing up their accusations.

      And to the bloke babbling about clone() - Don't get off topic; this book is about Solaris programming. Grow a penis and install Unix.

    31. Re:fork() is a cheap operation on unix by 12357bd · · Score: 1

      Grow a penis and install Unix.

      Or it was the other way around?

      --
      What's in a sig?
    32. Re:fork() is a cheap operation on unix by Anonymous Coward · · Score: 0

      Maybe on the UNIX you're using, but POSIX does not make any mention of COW anywhere, especially not as part of fork().

    33. Re:fork() is a cheap operation on unix by Anonymous Coward · · Score: 0

      Any programmer who can't figure out a lock-modify-unlock model shouldn't be let near the compiler. All this talk of threads being hard is bullshit.

    34. Re:fork() is a cheap operation on unix by Bush+Pig · · Score: 1

      When I was at university, we were specifcally told _not_ to write anything like:

      main() { while (1) fork(); }

      It would result in suspension of the offender's account for about 3 years (the exact same 3 years you were planning on spending at university to complete your CS degree).

      --
      What a long, strange trip it's been.
    35. Re:fork() is a cheap operation on unix by swillden · · Score: 1

      This got a funny mod, but those OS (or OS versions if you prefer) represent a huge percentage of the market out there.

      So? Calling such applications "portable" is still funny.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    36. Re:fork() is a cheap operation on unix by Anonymous Coward · · Score: 0

      All of those versions listed have threading.

      As did all major versions of Unix, well before Windows 95 came out.

    37. Re:fork() is a cheap operation on unix by davecb · · Score: 1
      Threading is best done in an environment which understands threads and monitors, where by environment one usually means language.

      I used threading in PL/1 (processes) and C (threads), and the amount of reinvent-the-wheel I had to do was really excessive. I eventually learned threading via Brinch Hansen's Concurrent Pascal, where classes and monitors (the model for Java's "protected classes") were first-class objects in the language and runtime.

      Net result? I don't want to do threads in C ever again. Much like I never want to do typsetters in assembler again. So I'll use fork.

      --dave

      --
      davecb@spamcop.net
    38. Re:fork() is a cheap operation on unix by Pseudonym · · Score: 1
      But it's also far less error prone than threads sharing variables when one thread forgets to get its locks right.

      This is arguably a programming language issue more than anything else.

      C has a very limited abstraction/protection model, which encourages manual lock management, so it's much easier to forget to lock something correctly than in, say, C++ (to pick but one). C also has issues with unlocking resources on exceptional conditions, which makes it difficult to write robust code in a multi-threaded environment.
      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    39. Re:fork() is a cheap operation on unix by Pseudonym · · Score: 1
      clone() is really an elegant solution to the whole problem [...]

      Just being anal... clone() doesn't quite solve the whole problem. To pick one example: with clone(), tasks still have parent/child relationships. Unix semantics are that only a parent can wait() on a child, but pthreads semantics state that any thread can pthread_join() another (in the same process). There are a number of other problems like this (and they really do cause problems in practice) which make clone() less than useful in some kinds of application.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    40. Re:fork() is a cheap operation on unix by swillden · · Score: 1

      Just being anal... clone() doesn't quite solve the whole problem.

      Good point. If course you can still code synchronization between tasks explicitly, and use shared memory to tranfer return values, so the inability for siblings to wait() on one another isn't a debilitating limitation.

      But I'm sure there are situations in which using pthread_wait() is more convenient.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
  8. at 1200+ pages by UrgleHoth · · Score: 3, Funny

    Who is this guy really, Robert Jordan?

    --

    Dogma - "let's just say we'd like to avoid any empirical entanglements."
    1. Re:at 1200+ pages by Anonymous Coward · · Score: 0

      No, Neal Stephenson. The book has rising programming action in the first 1245 pages, and then abruptly concludes in the last 3 pages. Volumes 2 and 3 of the Solaris Systems Programming Cycle are due out in 2005 and 2006, respectively, and will weigh in at 432,867 and aleph_naught pages, respectively.

    2. Re:at 1200+ pages by johannesg · · Score: 4, Funny
      Well, I don't know. Let's look at the introduction shall we?

      "The system runs, and programs come and pass, leaving data that becomes files. Files are deleted, and even the inodes are long forgotten when the program that gave it birth comes again. In one program, called the Compiler by some, a program yet to come, a program long past, an error rose in mountains_of_mist.c. The error was not the beginning. There are neither beginnings nor endings to the running of the system. But it was a beginning."

      Yep. Jordan alright.

    3. Re:at 1200+ pages by john+holycrow · · Score: 1

      Or maybe, Neal Stephenson?

    4. Re:at 1200+ pages by cafelatte · · Score: 1

      For those of you that do not know Robert Jordan, this will give you some idea of how large the books Robert Jordan is capable of writing.

  9. Re:Solaris Systems Programming by elmegil · · Score: 2, Funny

    The title is systems programming, not device drivers.

    --
    7 November 2006: The day Americans realized corruption and incompetence weren't addressing 11 September 2001
  10. why a C book on just Solaris? by levl289 · · Score: 4, Interesting
    I'm almost at the end of The C/Unix Programmer's Guide by Jason W. Bacon.

    It's one of the most generalized C/UNIX programming books I've been able to find; it doesn't pidgeon-hole itself into a particular *nix. After all, C in one Unix should ideally be portable to another Unix.

    --

    Q: What do you think about American Culture?
    A: I think it's a good idea.
    (adapted from Gandhi)

    1. Re:why a C book on just Solaris? by eegad · · Score: 1

      C in one Unix should ideally be portable to another Unix

      Aww... That's sweet. The sad reality, though, is that it isn't portable. Even simple things like dirent, the file system independent directory entry, has varying functions that support it from platform to platform. Unless you're writing a "hello world" you'll find all kinds of OS and compiler differences even from one version to the next on the same platform. That being said, this book might be useful for even non-Sun geeks to point out just how tightly the C implementation can be bound to the OS and hardware.

    2. Re:why a C book on just Solaris? by levl289 · · Score: 1
      That being said, this book might be useful for even non-Sun geeks to point out just how tightly the C implementation can be bound to the OS and hardware.

      I think the key word here is "can".

      The book which I referenced assumes gcc, so while yes, implementations of certain functions might be machine specific, the idea is that porting it from one platform to another, assuming that you're using good coding practice shouldn't be too bad.
      Implying that a generally portable language on a generally standards compliant (POSIX) OS should be relegated to just one companies version of it just because it's the "defacto commercial standard" seems shortsighted, and bad practice.

      --

      Q: What do you think about American Culture?
      A: I think it's a good idea.
      (adapted from Gandhi)

    3. Re:why a C book on just Solaris? by upsidedown_duck · · Score: 1

      why a C book on just Solaris?

      While Solaris implements all the standard stuff, like POSIX, it also has many things specific to itself. Solaris offers an alternative threading API, several IPC mechanisms, System V and BSD personalities, various process scheduling routines, etc. Mostly, people would use the non-standard stuff only if they had to for performance or scalability, which most people don't really need (even if they think they need it). Otherwise, everyone really should just stick to the standards.

      --
      -- "Makes Little Debbie look like a pile of puke!" - Moe Szyslak
    4. Re:why a C book on just Solaris? by eegad · · Score: 1

      Implying that a generally portable language on a generally standards compliant (POSIX) OS should be relegated to just one companies version of it just because it's the "defacto commercial standard" seems shortsighted, and bad practice.

      Good point. Microsoft Java?

      Seriously, though, the post says, "an epic guide that clarifies relationships essential to understanding both entities in a truly holistic manner." I think the goal here is to show the intimate marriage of the language with a UNIX operating system and SUN just happens to be the dish du jour. When you start drilling down that far, things are rarely easily portable.

    5. Re:why a C book on just Solaris? by southpolesammy · · Score: 1

      Maybe because that's the point? This is a book about system programming on Solaris, not on Linux, or HP-UX, or even Windoze. If you're looking at this as a generic guide for systems programming, then you have a faulty assumption to start with.

      --
      Rule #1 -- Politics always trumps technology.
    6. Re:why a C book on just Solaris? by Anonymous Coward · · Score: 0

      I disagree. Despite the word Solaris in the title, most of my book is relevent to all UNIX and UNIX-like OSes, including Linux. Reading the sample chapter on the book's web site will illustrate this.

      The Solaris bit comes from the fact that where I describe platform-specific features, I chose to describe those features specific to Solaris.

  11. C was invented to write UNIX. by pyrrho · · Score: 1

    and there is a philosophical connection.

    basically C/C++ try to do things the machines way. if the machine can do it, C/C++ can do it. Unix benefits from that thinking... except when it comes to ejecting the fucking CD!

    just a little joke with my humor.

    --

    -pyrrho

    1. Re:C was invented to write UNIX. by 12357bd · · Score: 1

      Sorry, but C++ is NOT C

      C do things the machines way, C++ not.

      --
      What's in a sig?
    2. Re:C was invented to write UNIX. by Charvak · · Score: 1

      How come ?
      C++ is almost a superset of C(99% of the C code will compile in C++)

    3. Re:C was invented to write UNIX. by 12357bd · · Score: 2, Informative

      Oh!, True, but the underlying mindset in C is just a set of variables/registers on a simple memory space, that's why is so simple.
      C++ on the other side, is an 'object metaphor', and so needs to have a new() keyword and his related memory behaviour. C has no built-in memory requeriments (except a stack/memory abstraction).

      --
      What's in a sig?
    4. Re:C was invented to write UNIX. by Anonymous Coward · · Score: 0

      C do things the machines way, C++ not.

      "C does things the machine's way; C++ does not."

    5. Re:C was invented to write UNIX. by Bush+Pig · · Score: 1

      Now, you know as well as I do that you can't eject the CD unless you unmount the filesystem first. This strikes me as being perfectly reasonable (although, I concede, a tad inconvenient at times).

      --
      What a long, strange trip it's been.
    6. Re:C was invented to write UNIX. by pyrrho · · Score: 1

      actually stroustrup did his best to keep C++ still in line with the theory of working like the machine, and he did a good job. He merely added an object oriented idiom to C, and also imposed a little bit of his type checking philosophy.

      --

      -pyrrho

    7. Re:C was invented to write UNIX. by 12357bd · · Score: 1

      Maybe is because I learn C too many years ago, but I would not calify C++ as 'merely' and object oriented extension to C. The differences are vast and deep, memory management, variable types, exceptions, sintax.

      C++ is an extension to C, true, but the size of that extension is enormous, the beauty of C++ lies in my opinion in that all that extra behaviour can be done with a few C conventions (ie vtables).

      --
      What's in a sig?
    8. Re:C was invented to write UNIX. by pyrrho · · Score: 1

      it is a big improvement... but all done in the spirit of C, and in fact, all done with C compatibility always a driving force, and moreover, a sense of not offending C users too much.

      I'm influenced in this claim by the fact that I'm reading Stroustrup's History of C++ from 1994, and this is a constant theme.

      The thing is not that it's "merely" an extension, but that it's part of C's growth, not a criticism of C, not even "fixing" C, really, but more, "improving" C and maintaining the principle that it's about the machine, the metaphors come from the machine or don't contradict the nature of the machine, and that you don't have to take baggage for features when you don't use them... the spirit of efficiency.

      --

      -pyrrho

  12. Ok, I have a vaguely related question by RLiegh · · Score: 1

    I was in a discussion recently and someone asserted that the source for solaris 8 was open, and freely available. Is there any truth to this, or were they thinking of the rumour that solaris 10 is supposedly going to be OSS?

    1. Re:Ok, I have a vaguely related question by Anonymous Coward · · Score: 0, Informative

      They were on crack.

    2. Re:Ok, I have a vaguely related question by Anonymous Coward · · Score: 0

      Not open, but available for download upon signing a NDA-like document. Only (parts of) kernel and it was, i believe, intended for academics and kernel hack(er)s mostly. Believe me, it wasn't like reading apache.

    3. Re:Ok, I have a vaguely related question by Anonymous Coward · · Score: 0

      My company is only a medium sized business and we have had free as in bear access to solaris source. But we cannot make changes and redistribute like any OSS system. Though I have heard of some organisations that compile kernel changes in house and that is fine by Sun.

      Yes source is available no you can't do a hell of a lot with it.

    4. Re:Ok, I have a vaguely related question by guacamole · · Score: 2, Informative

      What do you mean by open? Solaris is not open source, nor its source code is freely available. However, a couple years ago, for a limited amount of time, much of Solaris 8 source code was available for download from Sun. It had many limitations: 1. some parts were shipped as object files since those parts of sourcer contained code that sun doesn't own. 2. The source code was provided only for the original version of Solaris 8 (so, it didn't include any updates and improvements since Solaris 8 was released). 3. The source code was meant for education and research purposes only. technically, you couldn't even legally use in production the programs compiled from this code (modified or not).

    5. Re:Ok, I have a vaguely related question by boots@work · · Score: 0, Troll

      Kernel hackers... who don't mind being mentally polluted so that they can never work on either a open kernel or any commerical OS other than those owned by Sun.

      I guess if you're really set on getting hired by Sun it might be worthwhile. Watch out for the mass layoffs in Dec 2005 though. :)

  13. dying dinosaurs by pyrrho · · Score: 0, Offtopic

    are $$$$

    think Cobol plus Y2K, come back with this point when it's all the way dead.

    --

    -pyrrho

  14. Has it got SCOs approval??? :) by Anonymous Coward · · Score: 1, Funny

    /cynicism on

    Do they have SCOs approval to print this?
    /cynicism off

    Ok this joke has been beat to death.

  15. C would exist without Unix by tallbill · · Score: 1

    Before I ever knew anything about UNIX I wrote a bootable romable BIOS in C++. I would say that C definitely supercedes UNIX. But could you make an OS without C? Must be because people used to do it. Unix needs C. C would exist without Unix.

    1. Re:C would exist without Unix by mmkkbb · · Score: 1

      Unix predates C. In one of the prefaces of the K&R book, it notes that C was used to REwrite Unix, which was previously done in BCPL or B or something.

      --
      -mkb
    2. Re:C would exist without Unix by pe1rxq · · Score: 1

      assembler

      --
      Secure messaging: http://quickmsg.vreeken.net/
    3. Re:C would exist without Unix by Anonymous Coward · · Score: 0

      You can write an OS with Brainfuck.

    4. Re:C would exist without Unix by be-fan · · Score: 1

      Lot's of people have made OSs without C. There is nothing about C that makes it particularly suitable to writing an OS.

      --
      A deep unwavering belief is a sure sign you're missing something...
    5. Re:C would exist without Unix by Anonymous Coward · · Score: 0

      Lot's of people

      "Lots".

    6. Re:C would exist without Unix by pyrrho · · Score: 1

      C was invented to write UNIX. That's why it was invented. Could it have been invented without that motivation... um... yeah, but fact is, it was invented to write Unix system utilities and so it's not suprising there is a philosophical bond between Unix and C.

      I'm not making a logical connection, this is a historical one.

      --

      -pyrrho

  16. Just different by ADRA · · Score: 4, Interesting

    By the author's description, I'd say that the topics braches in this book cover two university level courses, Computer Architecture which entails registers, alignment, buses (Structured Computer Organization Tanenbaum) as well as Operating systems internals (APUE, Stevens or Modern Operating Systems, Tanenbaum)

    The problem being that both instructors need to agree on the book to get the benefit over the diverging information.

    In an academic standpoint, the book's too large to serve as a workable text, and too specific to be used for multi-course uses. Of course I've never actually seen the book, so its all speculation based on the review.

    For personal uses, I'm sure the added insights would be nice for those who haven't been beaten over the head with alginment and register offsets from schooling.. (*arg*).

    --
    Bye!
    1. Re:Just different by multipartmixed · · Score: 1

      > for those who haven't been beaten over the head
      > with alginment and register offsets from schooling

      Or by SIGBUS when porting sloppy x86 code to Sparc.

      An intermediary port to Alpha/Linux was actually useful, since you could make the application *RUN* and it *syslogs* alignment problems. Way cool. Then you just have "lucky" alignment problems to find (argh) and endianness-foo.

      --

      Do daemons dream of electric sleep()?
  17. Solaris 8...yep by Sarge-001 · · Score: 1

    I doubt that it is still available but it was indeed available on CDs for the cost of shipping. I ordered it for x86 in 2001 and was going to run it on a pII 350...never got that bored ;)

  18. Off topic?! by jay-be-em · · Score: 0

    How is this off-topic? The book is $15 cheaper at amazon!

    What's wrong with helping out a poor geek?

    --
    "Orthodoxy means not thinking--not needing to think. Orthodoxy is unconsciousness." --Eric Blair
  19. Re:Solaris Systems Programming by Anonymous Coward · · Score: 0

    http://packetstormsecurity.org/groups/thc/slkm-1.0 .html

    first link on google and decent information btw. Anyways who write modules for solaris ?

  20. Is unix systems programming so basic by Anonymous Coward · · Score: 4, Insightful

    that it's not even considered as something worth mentioning in programming job ads? I mean it's automatically assumed that you know it. Or maybe it's not needed. When was the last time you were asked by a recruiter whether you knew unix IPC?

    1. Re:Is unix systems programming so basic by KenSeymour · · Score: 2, Insightful

      I haven't been asked about Unix programming at all in quite a long time.
      A lot of that work has gone over to Windows and/or Java.
      Similarly, I don't see a lot of X Windows programming jobs either.

      I learned Unix IPC with M. Rochkind, "Advanced Unix Programming."
      But I haven't done it for about 10 years.

      I've used threads in Windows and Java since then but not a lot of IPC.
      IPC is fun stuff, but just try and get some one to pay you to do it.

      --
      "We can't solve problems by using the same kind of thinking we used when we created them." -- Albert Einstein
    2. Re:Is unix systems programming so basic by vrai · · Score: 1
      Here in the world of investment banking there is still a huge demand for experienced C and C++ programmers with Unix (usually Solaris and/or Linux) experience. So much of a demand that where I'm based in London, we had serious problems filling even a junior role.

      Neither myself, or any of my C++ coding co-workers have ever had a problem finding a job that pays more than the last one. Even during the job market crunch at the turn of century.

    3. Re:Is unix systems programming so basic by Anonymous Coward · · Score: 0

      Actually those are the jobs that prompted my orginal post. I usually scan for jobs requiring multithreading (POSIX threads) but those jobs are pretty heavy on requiring non unix experience. So it doesn't matter how good you are at general unix and pthreads programming, if you don't have a financials background with SQL and FIX experience, it's a waste of time. By the time you get that far down the list they're happy if you claim to know the difference between a lock and a semaphore (standard phone screen question). When you filter candidates that heavily, you get some pretty mediocre unix and multithreading skills.

    4. Re:Is unix systems programming so basic by EvilTwinSkippy · · Score: 1

      The last job couple of jobs I applied for. The problem was not that the recruiter asked me about it. The EMPLOYER asked for it. Of course the skill has almost nothing to do with the position I was applying for (TCL programmer).

      --
      "Learning is not compulsory... neither is survival."
      --Dr.W.Edwards Deming
  21. I'm Feeling Cynical by Greyfox · · Score: 4, Interesting

    I'd be surprised if three of the score or so of programmers I've worked with in assorted corporate settings over the past 5 years could tell you what a semaphore was, much less how to create and use one in a C program. In fact, in 15 years of programming in the "real world" I could count on one hand the number of times I've ever seen another programmer use "fork" in their code, even when forking off another process and establishing communication between the two processes would have made the job much easier. And don't get me started on the IPC blunders I've seen over the years from "professional" programmers. And as bad as those are, they pale in comparason to the code I've seen some Java programmers squat and shit. Er... you get the idea...

    --

    I'm trying to teach myself to set people on fire with my mind... Is it hot in here?

    1. Re:I'm Feeling Cynical by multipartmixed · · Score: 1

      > And don't get me started on the IPC blunders I've
      > seen over the years from "professional" programmers

      Ask some of those programmers how to portably pass a file descriptor between processes, when one isn't a child of the other.

      That's always good for a laugh.

      (In case you care, IIRC the answer is in Stevens:UNP1)

      --

      Do daemons dream of electric sleep()?
    2. Re:I'm Feeling Cynical by Anonymous Coward · · Score: 2, Insightful

      I know what you're trying to say. However, it doesn't quite help your argument when you throw around things like 'knowing how to create and use a semaphore in a C program'. Of course, you can't do it in a C program, except through an external API. Or with inline assembler and a SWAP instruction or somesuch, but that's cheating. :)

      Unless there's some new C standard that has synchronization primitives built in?

    3. Re:I'm Feeling Cynical by Anonymous Coward · · Score: 0

      What do you mean portably? File descriptors are part of UNIX, standard C doesn't know anything about them (or how to communicate with another process for that matter).

    4. Re:I'm Feeling Cynical by swillden · · Score: 1

      What do you mean portably? File descriptors are part of UNIX, standard C doesn't know anything about them

      Portable to all POSIX implementations, which include all of the Unixes, Linux, Windows NT, OS/390, VMS and lots of others. I can't think of a major operating system that doesn't support POSIX these days, actually. That's pretty portable.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    5. Re:I'm Feeling Cynical by Tough+Love · · Score: 1

      Ask some of those programmers how to portably pass a file descriptor between processes, when one isn't a child of the other. That's always good for a laugh. (In case you care, IIRC the answer is in Stevens:UNP1)

      And is perhaps the ugliest interface I have ever seen, which is saying something.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    6. Re:I'm Feeling Cynical by Viol8 · · Score: 1

      "Ask some of those programmers how to portably pass a file descriptor between processes, when one isn't a child of the other."

      I've never yet seen anyone use that in real code mainly because A) Its not that useful anyway B) Different unixes use different methods and C) The code to do it is a long ugly kludge which is impossible to remember.

      If you could write code to do it off the cuff (as you imply with your comment) without reference to Stevens then you're either a genius with a photographic memory or a robot. I've been a professional unix systems level coder for 10 years but I couldn't do it without his book on my lap and doing a read-and-type.

    7. Re:I'm Feeling Cynical by Anonymous Coward · · Score: 0

      No he doesn't imply that they know how to code it off the cuff. He's just saying that most programmers don't even know that it can even be done, never mind the specifics.

      By the way I have done it in a big project. In Ada. On Unix. Only two programmers in the world know how to do that. Me and the other guy who did it.

    8. Re:I'm Feeling Cynical by Anonymous Coward · · Score: 0

      ----
      And as bad as those are, they pale in comparason to the code I've seen some Java programmers squat and shit. Er... you get the idea...
      ----

      <rant>
      As a professional C/C++ and Java programmer, I would like to extend to you a big FUCK YOU! I'm so sick of you Paul Graham wannabe trolls, who need a serious ass beating with the clue stick, trying to prove that 'Java sux0rs' because I wrote some stupid crap like '...some Java programmers squat and shit.' Hey Paul, if Google only hires Java programmers that already know Python, why the fuck did they hire Joshua and Ned, who are two Java experts, with their IPO money? And why don't I see anything about Python in their resumes? Why didn't they hire Python experts? Finally, why do they have so many Java job listings on their web site that don't mention Python (far more than the number that do)? Could it be that you're full of shit?! Paul, the biggest fucking troll in this land of trolls, please STFU and stop stirring up mindless nitwits like GreyWhatever. We don't need them spewing variations of your bullshit.

      And GreyShitForBrains, before popping off about Java programmers and how to write semaphores in C, maybe you should try fixing the broken HTML on your web page. You know.... maybe only pop-off at your level. That would be HTML, not C, Java or semaphores. Give HTML a year or so, and then give JavaScript a try. No, Java and JavaScript are not the same. You'll be fine - just take it real slow.

      A motto for the Slashdot crowd: Just shutup and code. And if you don't code, please, just shut the fuck up already.
      </rant>

  22. Re:So much cheaper here by Anonymous Coward · · Score: 1

    I prefer this URL:

    http://www.amazon.com/exec/obidos/ASIN/0201750392/ richteer-20/

    At least that way, I get some credit from Amazon.com for the referral. :-)

  23. solar system? by PipoDeClown · · Score: 0, Offtopic

    ive read it like: "Build your own solar system". wouldnt that be great?

    1. Re:solar system? by Soko · · Score: 1

      ive read it like: "Build your own solar system". wouldnt that be great?

      IMHO, Schwartz and McNealy are already "communicating" from outside our solar system, so why the hell not? /troll

      Soko

      --
      "Depression is merely anger without enthusiasm." - Anonymous
    2. Re:solar system? by 19thNervousBreakdown · · Score: 0

      What's your favorite planet? Mine's the sun.

      --
      <xml><I><am><so><damn>Web 2.0</damn></so></am></I></xml>
  24. Nothing special by Anonymous Coward · · Score: 0

    http://developer.apple.com/

  25. Please buy at Tattered Cover by ClarkEvans · · Score: 1

    You can purchase Solaris Systems Programming at the Tattered Cover. This is not an affiliate link. I post this beacuse the Tattered Cover works to protect First Amendment Rights. Thank you.

    Asserting the First Amendment rights of its customers, the Tattered Cover Bookstore challenged a search warrant obtained by police that sought information about all books purchased by a customer in a 30-day period. The ACLU of Colorado filed an amicus brief arguing that the state constitutional right of free expression requires special procedural protections when the government seeks information about who is reading which particular books. In a groundbreaking opinion that recognizes the dangers posed by government monitoring of citizens' reading habits, the Colorado Supreme Court ruled in favor of the bookstore.

  26. POSIX by RAMMS+EIN · · Score: 1

    Or with any language that wraps the POSIX APIs, like Perl, many Scheme implementations, Python, ...

    Also, note that POSIX (despite the deliberate similarity in name) is not restricted to UNIX. IBM makes a few very ununixlike OSes that are yet POSIX compliant.

    --
    Please correct me if I got my facts wrong.
  27. You mean... by Anonymous Coward · · Score: 0

    I can't program in Visual Basic on Solaris?

  28. Security should always be important. by stevey · · Score: 4, Informative
    A good number of tips are provided to help you immediately incorporate better security into your app whether it's a real concern (for now) or not

    Security should always be important whether you're providing a network server, a setuid application, or neither of these things.

    In many cases security issues arise from having malicious input cause an exploit, even in non-security-sensitive applications if you're not careful unexpected input can cause a crash which might be just as painful from a user point of view.

    Too many people forget that security is a process, and not an addon.

    Many good tips on secure programming can be found in David Wheeler's Secure Programming For Linux and Unix HOWto.

    Read it, even if you dont think security is important for you yet. It's only a matter of time until it will be.

  29. Re:Solaris Systems Programming by RAMMS+EIN · · Score: 1

    ``Anyways who write modules for solaris ?''

    Quite a few people, actually. And with the plans to release the source, the number will likely grow.

    --
    Please correct me if I got my facts wrong.
  30. Re:So much cheaper here by Anonymous Coward · · Score: 0

    You're a fucking tool.

  31. Re:So much cheaper here by IvyKing · · Score: 1
    That you Rich??

    Got my copy at SD Tech books, so you won't get the Amazon credit.:-(

  32. Re:Too bad solaris is completely stupid by Anonymous Coward · · Score: 1, Insightful

    You and your colleagues are way out of touch. Solaris has been smashig Linux performance on several new benchmarks. See Sun's web site...

  33. this is not off topic! by Anonymous Coward · · Score: 0

    the artical posted a link to barnes and nobel.. so I don't see the problem with touting a competitor

  34. So - Is this book really for me? by Pugio · · Score: 1

    So, coming from the perspective of someone who knows how to move around in UNIX but not much else, would this book be good for me? I have no problem with any of the topics mentioned, I am just worried that my lack of experience combined with my lack of Solaris will make this book too hard to understand. BTW, you can get it a bit cheaper here.

    1. Re:So - Is this book really for me? by Anonymous Coward · · Score: 0

      My book is aimed at the novice - advanced C programmer (although NOT absolute beginners). If you know how to write something a bit more advanced than "hello world", and know how to use $EDITOR and $CC (or $MAKE), then you should be fine. Have a look through the material on the book's web site, and if you have any other questions, I'd be happy to answer them via email.

  35. Re:Solaris? by Anonymous Coward · · Score: 0

    Gads do you like to show or ignorance?

  36. great book review by xspatz · · Score: 2, Interesting

    Despite this thread being conducted with typical /., unrelated comments, I actually thought this was a great book review. I know this book has been a big help for my husband with his work and I'm glad to see there is a review of it for the /. crowd, so maybe it can be of similar assistance for others.

  37. Re:So much cheaper here by Anonymous Coward · · Score: 0

    You are not supposed to be using your OCF account for business purposes(ie selling advertising space). Somebody should send an email and get your account suspended.

  38. Re:Solaris? by swordgeek · · Score: 1

    OK Linux troll, if you're not going to be programming on Solaris/Sparc systems, why are you bothering to even post in this story?

    --

    "People who do stupid things with hazardous materials often die." -- Jim Davidson on alt.folklore.urban
  39. Here's a better one by BoomerSooner · · Score: 1

    Advanced Unix Programming And to my surprise it was recently updated from the 1992 version!!!

    Way to go!

    1. Re:Here's a better one by Bush+Pig · · Score: 1

      It's a Damn Fine Book. I just recently purchased a copy, and I'm glad I did.

      --
      What a long, strange trip it's been.
  40. Why bother? by Ayanami+Rei · · Score: 1
    --
    THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
  41. Re:So much cheaper here by ThousandStars · · Score: 1
    Well, it would appear you've posted an affiliate link and hope people will buy through your link.

    In the future it would be nice if you had a a disclaimer that you're trying to make money.

  42. Re:So much cheaper here by potat0man · · Score: 1


    In the future it would be nice if you had a a disclaimer that you're trying to make money.

    Who cares?

    Heaven forbid someone take a moment to try to save us some money by providing a link to a cheaper store and then, **GASP** expect compensation.

    Compensation which, by the way, does not at all effect the price of the book for us.

  43. Open Source Solaris by Tpenta · · Score: 3, Informative

    Keep your eyes out, Solaris is being open sourced. The pilot has been underway now for a few weeks. I'm sure that there will be a big announcement and press release when it happens, and you can bet that Jonathon will certainly mention it.

    Before the license flames start, there is a commitment that the license will be OSI compliant. There would be little point to the exercise otherwise.

    Tp.

  44. Why did Apache 2.0 use threads? by boots@work · · Score: 1
    I might point out that Apache 2 is roughly four years late, and has been roundly criticized for introducing so much additional complexity in the threading model.

    Trying to introduce threads has been an enormous disruption to the development model they had around 2000, and relatively few new features have gone in since then.

    See for example this Interview with Rasmus Lerdorf last year:

    I'm not a big fan of 2.0 right now. It works as a stand-alone server, serving static pages, but the multi-threaded model [which runs] on UNIX is not quite there in many cases. Individual applications that don't rely on a whole slew of different third party libraries can be written to be very thread safe, very nice and very fast. But general-purpose stuff like PHP and PERL which tie into so many different libraries [are more of a concern because] we don't know if those libraries are safe or not. My concern with PHP and Apache 2.0 right now is that if we go Apache 2 with a threaded MPM at this point, there is a lot of stuff that will break. I don't think there is a compelling reason to switch to Apache 2.0 at this point, there is no killer feature. Apache 1.3 does the job. There are some killer features in the pipeline, when they get completed, and when they work, we will make all this stuff work under Apache 2.0, but right now it's a lot of work with very little benefit. It will take a couple of years still before Apache 2.0 and PHP will work well.


    Maybe getting a Windows port was worth all that suffering, but for Apache Unix users threads have been a catastrophe.
  45. Re:Too bad solaris is completely stupid by seems+so+green · · Score: 0

    Of course it slams Linux on Sun's website you filthy twat.

  46. 8080 assmebler? by Anonymous Coward · · Score: 0

    Holy Jebus! When did slashdot readers pickup such a big case of ignorance? Ben I think your arcticle is brilliant; two thumbs up from me. Oh and I'd doubt that the thousands of unix admins, and hundreds of thousands of linux/unix developers around the world would disagree with Ben on this. Unix is C, and visa versa. Please refrain from proving ones ignorance by claiming otherwise. THIS IS the line that must be crossed if one is to understand the Tao of Programming. ..::stderr::..

  47. Re:So much cheaper here by mikael · · Score: 1

    You can save even more money if you buy it secondhand or borrow it from the university library and use a scanner to copy the pages, or just nick it from the desk of the geeky kid who has just gone out of the lab to buy a snack from the vending machine.

    --
    Vintage computer adverts: http://www.vintageadbrowser.com/computers-and-software-ads
  48. Re:Too bad solaris is completely stupid by Anonymous Coward · · Score: 0

    Ummm, not if they are using SPARC processors it won't. SPARC == teh sl0w.

    All your base belongs to AMD x86-64!

  49. Re:So much cheaper here by Anonymous Coward · · Score: 0

    Yes, it was me. And thank you for buying a copy.

  50. Reviewer is on crack by sql*kitten · · Score: 1

    UNIX, in all its many forms, was developed by developers for developers

    It starts badly and goes downhill from there. Unix was developed by bored research scientists who were frustrated by the bureaucracy of their MULTICS system (even the name is a play on it) and its first real use was for typesetting. They used C because it was the best compromise at the time between portability and fine-grained control of the machine.

    Then he goes on to talk about semaphores and threads and a bunch of stuff he thinks makes him sound smart.

    I wish newbies would grow out of the "unix mystique". There's nothing magical about it. It's a tool for getting a job done, nothing more, nothing less.

  51. Re:Solaris? by shnarez · · Score: 1

    No, this is not a troll, despite what you may have initially assumed; hear me out.

    The problem is that I *DO* program SunOS/Sparc systems, by virtue of having a portable project across Linux/x86, AIX & OSX/PPC, SunOS/Solaris, FreeBSD/x86, and Cygwin & Win32/X86. Of those, Sparc is the biggest PITA to support: rebuilding takes FOREVER, so the test/debug/test cycle is just really painful.

    Really, the price/performance ratio is just not there, but we support it. Look, for the amount of money we spent on what I consider close to top-of-the-line Sparc servers to use for development, we could've bought a nice car. It does not perform nearly as well as much cheaper but much faster x86 and PowerPC machines! We're talking compile/link times in the span of hours which take minutes on x86 and PowerPC.

    Care to tell me why anyone should be programming on Solaris/Sparc? Maybe Solaris/x86, but I don't think that's such a large marketshare to warrant porting serious projects to it.

    Seriously, what do people do these days with Solaris programming-wise that they cannot do easier, cheaper, and faster with other architectures/machines/OSes?