March 8, 2008: Die Siedler von Catan Tag

I slept until nine thirty this morning and boy did I ever need it. I was so exhausted yesterday. Today Dominica and I are going to attempt to just relax as much as possible.

Dominica Taking GPS Readings at NJPAC

We did breakfast over at Airlie Cafe and Dominica got introduced to their awesome salads. She didn’t want one when she first sent me over for food but changed her mind after trying a bite of mine. So after a while she sent me back over, in the pouring rain, to get her a salad as well.

The weather was crazy today. The rain began last night and went steadily all evening and all night. This morning it got much heavier but came in a strange cycle of light to incredibly heavy that lasted for the entire day. The entire area was flooded. Oreo’s little bit of mulch and groundcover where he likes to do his business was completely under water, and the streets were just flowing with the water that couldn’t make it into the storm drains.

Dominica and I decided to play some Munchkin Cthulhu that Dominica had picked up at Barnes & Noble last week. It isn’t much fun with just the two of us but we gave it a try. We played two games of that and then played some Settlers of Catan (a.k.a. Die Siedler von Catan) which Min is now addicted to.

I did some web design and touch-up work today. This has been a week of doing straight-HTML to PHP-managed-HTML conversions. The sooner you do it the less work it is in the long run.
I had to work a bit this evening. I was scheduled to start at four in the afternoon so our day was rather short. I ended up working from four until nine. Not bad compared to how much everyone else at the office had to work today but I was still pretty tired from yesterday. The work was very simple, though, and not stressful at all. Mostly just support work and a little paperwork. Good work for a Saturday.

Around eight or so Dominica switched over to doing her homework for her GPS and the New Geography class which she ended up working on until a little before one in the morning. Oreo and I were very tired so we went ahead and went to bed and I read some in my “The Art of Project Management” book and then listened to the first disc of “More News from Lake Wobegon” by Garrison Keillor which is from 1989, I believe. The first disc has by far some of the most famous skits on it including “Pontoon” which has become possibly the best known of Garrison’s “News from Lake Wobegon” skits over the past year or two as it has been released on several collections and incorporated into his latest novel “Pontoon”.

Dominica has a lot more homework to do tomorrow. I have nothing scheduled except for some web design consulting for Previsor/Brainbench. I will be doing some relaxing tomorrow. Maybe getting caught up on some house chores.

March 7, 2008: Really Long Day

My morning started at four thirty when I was paged out from bed. I had gone to bed early last night after taking several evening pages and was paged out from bed as soon as I went. I had gone to bed early because I am covering the early shift today at six thirty. But since I was already up at four thirty and had lots of people looking for work already and I didn’t have enough time to sleep I just “went to work” and got started for the day. It was probably best since there was plenty of work to keep me busy and that means that other people were then able to work because I was taking care of them.

Recently, the gaming world has been mourning the loss of its illustrious founder – Gary Gygax passed away this week.

Today was incredibly long and very busy.  I didn’t get a chance to keep up with SGL throughout the day as I normally would. I ended up working solidly from four thirty in the morning until almost seven in the evening.  At that point Dominica made dinner and we just relaxed by watching the next disc of Doctor Who that had arrived from Netflix.  I stayed up until half eleven watching work email on my BlackBerry to make sure that I was not needed.  At that point I was too tired and just went to bed.  There is only so much that I can do.

So I am sorry that the update is so short and wimpy today.  Not much that I can do about it.

CPUs, Cores and Threads: How Many Processors Do I Have?

In my job role I am very often called upon to determine how many “processors” a machine has or how many we will need for a specific task. Ten years ago this was a simple process but today even the very concept of the “processor” is fuzzy at best and only a very few people have a clear understanding of what it means. I spend much of my time explaining, as best as possible, the terms needed to even discuss processors today as everything processor related must be seen in context.

Before we begin let us look at the terms involved in discussing processors starting from the bottom of the stack. On the bottom we have a chip carrier, this can be something as simple as a motherboard (a.k.a. mainboard, systemboard, MoBo), a processor daughtercard or a dedicated chip carrier. Any of these will qualify for our use. A chip carrier holds sockets. Chip carriers can have a single socket or many.

On a standard desktop or laptop computer we would expect to find that we have a single motherboard containing a single socket. On a mid-sized server such as the HP DL360 G5 we see a single motherboard with two sockets. On a larger server such as the Sun SunFire x4600 we see several daughtercards each with a single socket but with a total of eight sockets available in the overall system.

The Intel Pentium III Slot A chips are a perfect example of a dedicated chip carrier. In the case of the Slot A Pentium III processors the processor itself was mounted directly onto a small daughterboard that was dedicated for the purpose of carrying the Pentium III processor and its associated voltage management electronics. This small card was enclosed in plastic for protection and would be attached directly to the motherboard.

Above the layer of the chip carrier is the socket. A socket is a physical connector allow a chip to be connected to a board. Occasionally a chip as important as the CPU will be connected to a board without a socket. This is more common when dealing with embedded systems and is exceedingly rare in general purpose computing. In this case the connection itself could be considered analogous to the socket. The use of the socket in this explanation can be confusing because of its questionable interpretation but it is important in its inclusion because of the need to identify potential system capacity and classification which is done, normally, at this level.

It is in the counting of sockets per computer that we determine that maximum “way” of a server. For example the DL360 mentioned above is classified as a two-way server. And the x4600 is an eight-way server. This is the case when the server is at capacity. A particular server would be classified by the number of sockets in use. For example a DL385 with just one socket occupied could be considered a one-way server but with extra potential capacity. By adding another chip to the second socket we are said to be upgrading from a one-way to a two-way. Many server vendors have started advertising the “way” of their servers based on non-socket based factors but this practice is non-standard and highly misleading. Be sure to compare servers based on socket capacity and not on advertised “way”.

Each socket is capable of holding one physical processor. While sockets are purchased with the board to which they are attached, a chip can be purchased already in a socket or as a standalone product. Processors are often sold in stores in boxes just like any other product and are the most visible form of “processor” that consumers will face. This is the only “processor” that can be seen visibly, held in the hand, bought as an item in a store, etc. This is the physical manifestation of processing power. Just as socket count determines the maximum “way” of a computer the processor count will determine the current “way” of that computer. Most consumers or desktop administrators think of processors in terms of the physical chip. If the term processor is to have an official usage this is the level at which it is most appropriate. Common examples of a processor include the AMD Opteron, Intel Core, Intel Pentium II, Sun UltraSpark IV or IBM Power6.

The most important industry recognition of this “level” being the “processor” is Microsoft, Oracle and most major software vendors using this definition of processor to determine their per-processor licensing requirements. Because of this stand on the definition of processor and its long history of use mostly in this context we are likely to see the word processor remain linked to the physical entity.

Each processor chip can have one or more die carried within it. A die is not visible as it is encased in the protective material of the processor. The die consists of the semi-conductive substrate and is a discrete electrical element within the processor. A die is the most difficult portion of a processor to define, in my opinion, as it is completely invisible to anyone unless they break apart a processor and even so they are extremely difficult to see because of their size and density.

A CPU, or Central Processing Unit, is, and has been, generally tied to a die. One die contains one single CPU. A die and a traditional CPU are, roughly, synonymous. Technically an important difference remains because a die can contain components in addition to the CPU such as support processing. In a more general sense, a die can contain other types of integrated circuits other than a CPU so the two words are not the same thing even though they effectively are when we are only discussing general use processors – CPUs. Strangely it is at this level that we have achieved the term CPU used so commonly but so extremely misunderstood.

Within a single CPU there can be one or more processing cores. A core is the real workhorse of the processor stack. It is within a core that the actual processing work is done. It is most common, today, for a CPU to contain only one core. There is a common misconception that this is not the case due to marketing efforts to convince people otherwise. Internal processor architecture should not be used as a marketing tool as it is simply confusing and misleading. Only a holistic view of processor performance characteristics can provide adequate comparisons when deciding on a processing platform. No single architectural element will have an impact large enough to be usable as a determining factor in processor selection. But more importantly it is not feasible for anyone who is not a chip architect with a solid grounding in IC design concepts to even remotely grasp the intricacies involved in the design of a microprocessor.

In traditional processors, like the Pentium III, there is one core per CPU. This is very simple. In many modern processors such as the Intel Core or the Intel Core 2 there is still only one core per CPU while there are multiple CPUs per processor (each CPU is on a discrete die within the processor.) So an Intel Core 2 Duo would be a single processor with two die each with one CPU each with one core. This gives a total of two cores per processor. It is multi-core as well as being multi-CPU. Technically the term multi-core should not apply here as that is only useful in a different and important context. In the AMD Opteron processor we see a single processor with a single die and single CPU with two cores within that single CPU. In this case we have a multi-core single-CPU configuration. This is a true multi-core processor. Multi-core within a single die/CPU is an important distinction because it varies the ability for components to communicate amongst themselves. The most confusing thing here is that Intel product is named “Core” while being based on multi-CPU technology. This has lead to a proliferation in the misuse of the term core.

Cores are still an extremely important component to use in normal system discussions, however. Cores are discrete processing elements and therefore represent a very important look at our computers. By looking at cores we can see how many independent parallel actions can be taken by the processors at one time. This is very important for understanding the scaling and capacity abilities of our computers. A computer can only truly parallelize to the extent of its “core” capacity.

The final layer of our stack that we need to examine is that of the multithread (a.k.a. Hyper-Thread, SuperThread, etc.) The most well known example of this is Intel’s implementation of such used in their Pentium 4 derived XEON processors. In current use the Sun UltraSparc T family of processors are the poster-children for multithreading. Multithreading does not truly add additionally parallelism to the processing structure but it can be used, under certain loads, to make the processing pipeline more efficient and to push multiple threads of execution into the processor roughly simultaneously. Multithreading is complicated but in the absolutely simplest terms (and possibly the most useful to the layman looking to grasp the correct use of this technology) it can be though of as allowing the processor to manage thread execution and scheduling instead of leaving this solely to the operating system. In reality what is performed is vastly most complicated than this.

Multithreading is useless for single-threaded workloads and its mere presence will degrade performance. Multithreading is most useful for highly threaded workloads. It is currently seeing a lot of positive use in the areas of web servers and databases. To transfer decision making from the operating system to the multithreading portion of the processor, an MT processor presents each of its thread processors to the operating system as a separate “logical processor”. It is at this point that we finally see the concept of processor as viewed by the operating system. This “logical processor” is what we view in Microsoft’s PerfMon or TaskMgr or in top on Linux. Often this is what we think of as being the processor.

Now that we have been bombarded with terms, layers and models we will look at a few examples to help determine how we should approach the classification of processors. We will look at the HP DL360 G2, the HP DL585 G2, the HP DL580 G4, the HP and the SunFire T2000.

In our first example we will look at the very traditional and standard Hewlett-Packard/Compaq Proliant DL360 G2. This server has a single motherboard containing two processor sockets. Each socket accepts one Intel Pentium III-S processor (up to 1.4GHz.) At this level we can identify this server as a true two-way server. Each Pentium III-S processor contains a single die / CPU. Each CPU has one core and each core is natively threaded with no multithreading capabilities. So, in total, this server is a two-way server with two processors, two CPUs, two cores and two logical processors to present to the operating system. Very simple, very straightforward. Just as we expect a computer to behave.

Our second example is the Hewlett-Packard Proliant DL585 G2. This server has four processor sockets on its motherboard making it a true four-way server. Each socket can hold an AMD Rev F Opteron Dual-Core processor. Each Opteron, in this scenario, has a single die with a single CPU. Each CPU has two cores and each core has only the native thread handler providing a total of one logical processor per core. So our total is four-way, four die / CPU, eight core and eight logical processors presented to the operating system.

Our third example is the Hewlett-Packard Proliant DL580 G4. The Proliant DL580 G4 has a four socket motherboard capable of holding four Dual-Core Intel XEON 7000 series processors. This, like the DL585 G2, is a true four-way server when fully populated. Each XEON 7000 processor contains dual dies / CPUs and each CPU contains one core for a total of two cores per processor. Each core has a single native thread handler. So our total is four-way, eight die / CPU, eight core and eight logical processors presented to the operating system.

My desktop example is the Hewlett-Packard Compaq DeskPro d530. This desktop unit has the option of using the Intel Pentium 4 HyperThread processor which is what makes it interesting for our purposes. We will use this processor in our example. The DeskPro d530 has a motherboard that supports a single Pentium 4 (or Celeron 4) processor. Like most desktops this is a one-way machine. Each Pentium 4 processor has a single die / CPU with a single execution core. Each core on a traditional Pentium 4 (or Celeron 4) can execute just a single thread but, in our example, we will use the HyperThread version of the P4 which can handle two simultaneous threads presenting two logical processors to the operating system. So we have a one-way desktop with a single processor with a single CPU containing a single core with two mulithread handlers presenting two logical processors.

To make this analysis more complicated we must also be aware that because of single thread performance problems on the Pentium 4 HT platform it was very common for HyperThreading to be disabled on this processors through a BIOS setting. In these cases the threading model returns to native and only a single logical processor is presented to the operating system. This is the only example, of which I am aware, of a processor having a selectable number of presentable logical processors. The efficacy of using the HyperThread features was based upon operating system and load characteristics. For example, Windows 98SE or ME running on the d530 could not even see the second logical processor because it only has a uni-processor kernel option. So HyperThreading is not even possible. With Windows 2000 or XP both logical processors were visible and usable but some workloads, such as most video games at the time, could not take advantage of it while many business workloads would. Each user would have to determine which mode made the most sense for them adding to the complexity of the situation.

Our final example is the Sun SunFire T2000 server. The SunFire T2000 is a single socket motherboard designed to hold one UltraSparc T processor. This is a true one-way server. Each UltraSparc T processor has a single die / CPU. Each CPU contains either four, six or eight cores depending on the purchased configuration – we will use eight in our example. Each of these eight cores has four thread handlers. In this machine we therefore see a one-way server with a single processor with a single CPU containing eight cores and a total of thirty-two simultaneous multithreads being presented to the operating system as thirty-two logical processors.

As computer systems continue to increase the number of logical processors being presented to the operating system the importance of efficient process and thread handling by the operating system kernel will continue to become more and more important.  Many traditional systems have not been able to handle multi-processor situations very efficiently, if at all, but today with the number of available logical processors skyrocketing even in desktops the need for good process and thread handling across a potentially large number of logical processors is extremely important.

As you can see the issue of determining the number of processors, cores, CPUs, etc. is extremely difficult.  It is clear why people have become confused and why marketing is playing such a significant role in determining the public’s perceptions of these architectural components.  The most important components to keep clear are the counts for way, processor, core and logical processor (virtual processor, processing thread, execution engine, etc.)  Underlying component issues, while important to be semantically correct and to understand the working of processors, are still underlying components and should not be thought of as being the defining characteristics of our computer systems today.

Simple Website Management with PHP Includes

We all know the importance of the careful separation of websites into their three discrete elements – content in the form of XHTML, style in the form of CSS (Cascading Style Sheets) and behavior in the form of JavaScript. This is the basic foundation of correct, clean and functional web design. Once one has accomplished this basic building block of manageability one must look to external tools in order to achieve greater gains in website management and maintenance. Often we find a solution in heavy Content Management Systems or CMS. But often, especially for smaller web sites, there is a far simpler solution that still allows for growth and maintainability. Enter the PHP Include.

Before we get into discussing the use of the PHP Include for maintaining website I would like to first mention the oft forgotten Server Side Include or SSI. I have nothing against the old Server Side Include. I used to use it, in fact, and I believe that it is extremely functional. However, PHP has become so ubiquitous on web servers today (especially Apache) and it is so easy to use for this purpose that I feel that its advantages in growth and flexibility outweigh the slight increase in processing necessary to use it. PHP Includes are simple, straightforward and flexible when we want to start doing just that little bit more with our site than we did before.

The first step to working with PHP is to have PHP enabled in your web server. PHP requires nothing in the client browser – it is a web server only technology. Everything that we will be doing here is server side. Most web servers today already have PHP turned on and ready by default. The notable exception to this is Microsoft’s IIS where you will have to manually install PHP. Check the instructions for your particular web server on how to enable PHP for your use.

The process that I prefer to use when building a website using PHP Includes is to first build my first “prototype” page using traditional XHTML, CSS and JavaScript. One I have the basics of the page I then start by chopping out everything before the <body> tag and pasting it into a file that I like to call header.inc. I can then replace the entire section that I removed with the following simple PHP line:

<?php include("header.inc"); ?>

If this is your first time working with PHP this is a good time to test your page. I like to rename my pages from *.html to *.php once I have modified them. This makes it more evident to me what I am working on and when. I will assume that we are working on a default page here and that we can call it index.php. You should now test your page to be sure that it is rendering correctly. Any browser should now see the page as identical to the *.html equivalent. What we have done is simply take the top of the page and move it into a separate, reusable file. The PHP Include statement is simply taking the header.inc file and concatenating it back into the page at the last minute when the page is requested. It we were only ever to work on a single page this would be silly and a waste of time and effort. But it is a rare thing to have a web site with only a single page. Our goal here is to make a multi-page site easy to manage, control and standardize.

Now that you have the basics of the PHP Include working we can work on expanding its use. Simply handling the declaration and head portions of our page are not enough to make the PHP Include truly useful. This would reduce on-disk file sizes and remove a few maintenance tasks but the gains would be few. The true value begins when we start including portions of the page body in our includes. Now the fun really begins.

Now we need to identify the portion of the top of our page that will be common to every individual page that we will have in our site. In many cases this will be a banner area and navigational elements – most often a menu of some sort. We want to be sure to find every line that will be duplicated exactly and none that need to be different in each page. Once you have identified this page portion you can cut that bit of text and paste it to the bottom of your header.inc file. Quite often I find that this section will include quite a bit of menu markup as well as many “setup” tags such as common opening <div> tags. The more that you can manage in this manner the more value you get from it.

If you want, save everything and test the site again to be sure that nothing is broken so far. Nothing is? Good. Now we need to do a similar task to the bottom of our index.php page. We need to identify where the custom page-specific material ends and the common “wrap up” material begins. In my experience this is generally a relatively small about of markup but will often include a “bottom bar”, some <div> closeouts and often some late-running JavaScript such as Google Analytics or other tracking code.

Once you have identified the common bottom code that is shared, or will be shared, between your pages you can cut it out and paste it into a new file that I like to call footer.inc. The .inc extensions are not necessary but I find that it really helps to make these files easy to find. Now in place of the markup that we removed from index.php we can add in:

<?php include("footer.inc"); ?>

Now test your page again. Nothing should have changed in your web browser. But now your page is significantly easier to manage going forward. You can now create many new pages and simply start them with the PHP Include “Header” line and end them with the PHP Include “Footer” line and all you have to do from page to page is fill in the content that goes between. This will speed initial page generation but more importantly will make updates and management far easier. If you need to add a new <base> or <link> tag, for example, you can simply add it into header.inc and instantly it is applied to every page that you have created. When you create a new page and need to add a link into your navigational menu you can simply add it in and instantly every page’s navigation menu is updated.

Not every page will benefit from this approach but most traditional pages used by small business and most “brochure” style pages will. Often you may need to exclude your default page (a.k.a. index.html) because it might be different from all of your other pages. That is fine. Don’t let that be a show stopper for you. Just manage all of your other pages together.

To get even more value from this approach you can begin looking for common shared elements between pages. If you have a navigational bar that appears in the middle of the pages you could create navigation.inc and move that shared markup out to that file to manage more easily. Of course you can also do this with markup shared between any two pages – it doesn’t have to common to every page. Just use the appropriate PHP Include on the right pages and voilà, less work when adding content or making changes to your site.

March 6, 2008: Not Much Sleep Heading Towards the Weekend

I didn’t quite make it to bed tonight before the staff in Bahrain had come online. Them being seven hours ahead of us is hard to deal with. They work really long hours there. I ended up working until one thirty in the morning before being able to go in to bed and still I was checking the BlackBerry most of the night. Fortunately there was very little activity last night and it wasn’t too bad. I only had to get up once during the night after having gone to bed to take care of something.

Unlike most of my days at home there were really no dishes to do today. Dominica did them last night and cleaned the kitchen before I got home. My first domestic job of the day was to attempt to save our rose bush in the east window. It was doing great as it was getting sunlight recently but we let it go way too long without water and it is extremely unhappy with us at this point.

This morning was quite busy at work. The afternoon was not nearly so bad. But there was still a lot to do. Oreo had a great day as there was a ton of sunlight and he got the chance the just sleep and sleep. He didn’t wake up to go outside until after five in the afternoon! Dominica had already left the office and was heading home by the time he crawled out of bed and asked to be taken outside for his walk. He didn’t eat breakfast until minutes before she got home. What a lazy boy. He was very smiley all day. Daycare really wears him out as he gets older.

Dominica got home and was so tired that she didn’t even want to eat dinner. So Ryan and I went down to the wine and cheese party that TD Bancnorth (a tenant in our apartment building here at Eleven80) was having as a “getting to know our neighbours” event just for the residents. We went at a few minutes after six – half an hour after the event started and we were the first two people there. We felt really badly that no one bothered to show up at all. But the event was scheduled before most people at Eleven80 would get home from work and there were no reminders in the elevators for the event so everyone forgets. I had forgotten until Ryan reminded me.

Eventually two more people from Eleven80 showed up and one person who works at the Carlton Hotel (a homeless shelter nearby) who was wandering by and saw the harpist playing in the lobby. That was the total crowd all evening. We were having a good time visiting with people and talking but I was paged out between seven and seven thirty so I had to leave and run back home. When I left, Ryan and another resident that we were talking to (who actually graduated from Monroe Community College, same as me) both left with me leaving only one resident to stay until the event was done.

So I worked for a little bit and then had a snack with Dominica while we watched an episode of A Different World. We would have watched more but I had scheduled work tonight at eight thirty and I knew that we would likely be interrupted a bit so I just worked in the office until ten thirty. Dominica played MySims to get herself ready to fall asleep while I worked.

I tried going to bed at ten thirty so that I would have some sleep before getting hit with overnight calls and then having to do the early morning shift tomorrow (oh is that going to be rough) and no sooner did I lay down in bed – didn’t even get a chance to put on my CPAP – than I was paged out to support servers from another team. Someone thought that the overnight coverage happened hours early and thought that I was doing full coverage and so paged me out at a time when I would never have possibly been called normally. It is not going to be a good night. I can tell.

Actually it work out alright and I wasn’t paged out again until four thirty in the morning. That gave me enough time to get one or maybe even two actual sleep periods and, although I was completely exhausted, I was able to just get up and start my day. Since my shift needs to begin at six thirty anyway and since there is no one covering the overnight there is a very high risk of being called several times as we approach the start of the day. And this will keep other people from being paged out unnecessarily. We all have a long weekend coming up and I need to offload as much of it as possible as the weekend work impacts me very little. But most importantly I can’t keep letting Dominica get woken up. She had a terrible day yesterday because she was so tired and tried to go to bed very early last night. She doesn’t handle sleep interruptions like I do and the phone ringing throughout the night really disrupts her sleep patterns.

I eventually tracked down that one person from one team got confused and thought that I was covering the overnights this week. That person then told the call center that I was covering the overnights. The call center then spread it around and now, whether I like it or not, I am covering the overnight work, the early morning work and the late deployments on Friday. Thank goodness for coffee. And if you are reading this to see if I am available to do anything this evening – no, I am staying here. I am going to be very tired on Friday night. Sorry.