The Global Leader in PC & Android System Health Solutions

Month: August 2007 (Page 5 of 6)

Multithreaded Programming for the Masses

Writing software on multicore CPUs is a hard problem. The chip designers have told us that they’re not going to do all the work for us programmers anymore. Now we have to do something. (Here’s a good description of the problem from Herb Sutter.) Writing multithreaded apps is not easy. I’ve done a lot of it in C++, and the tools, the libraries, and the design patterns just don’t make it trivial. I don’t mean to say that it’s impossible, however. It’s certainly possible if you’re careful, you plan for it from the beginning, and you know what you’re doing. The real problem is that 99% of programmers aren’t all that good. A defect in multithreaded code can be really hard to track down, so it’s expensive if you get it wrong. A lot of companies and research groups have been spending a lot of time trying to figure out how to make it easier. I haven’t been doing any research on the topic, but, like a good blogger, I’m going to comment on it anyway.

First of all, do we have to speed up all applications by the number of cores in your CPU? Your typical Visual Basic programmer isn’t any good at threading, but do they have to be? They can create dialog boxes and display data and let you edit that data. Do they have to know anything about threads for this?

Probably not.

It’s still possible to speed up that dialog box, too. If there’s some text entered by the user, the grammar/spelling checker might be running on a different core from the UI widget. This wasn’t done by the Visual Basic programmer. The dialog might have been drawn using a graphics engine that used threads or even offloaded some computations to the video card. Again, this wasn’t done by the programmer who’s never worried about threads.

So, we don’t always have to know about threads. Some substantial fraction of the programmers in the world don’t have to speed up their code using multiple cores. That’s good news. We really need to admit that not all programmers need to make their programs faster. The libraries they use can be made faster without compromising the reliability of the program itself.

That’s not the whole story, though. Let’s look at the other end of the spectrum. How about a video game?

Graphical processing is astonishingly easy to parallelize. GPUs will continue to get faster over time because of this. A lot of calculations can be done on individual pixels. It’s relatively rare that two pixels that are far apart will affect each other substantially. (There are some techniques that defy this statement, but a lot of them rely heavily on expensive matrix calculations which may be parallelizable. I know nothing about these techniques, but I’m going to guess that they’re easy to parallelize, too.)

If video cards are going to continue to get faster, then the CPU had better keep up. The CPU is going to have to generate enough data to avoid starving the GPU. As the GPU gets infinitely fast compared to a single core of the CPU, this will require multiple cores.

Uh, oh. Does this mean that all game designers will need to use multiple threads?

I’m sure that it doesn’t. Couldn’t the game engine programmers do all of the hard work and let the average game programmer use a safe API that avoids threads? Certainly a level designer who’s scripting an in-game event in Lua would not be forced to worry about threads!

What about an AI programmer? I don’t know enough about game engine design to say for sure, but I’d be willing to bet that a cleverly designed game engine could avoid exposing a lot of the multithreaded mess to many programmers, but at some point AI programmers will have to do things on multiple cores at the same time.

While the AI programmer might be fairly smart, and they might be trained in multithreaded programming techniques, that does not mean that it’s a good idea to subject him or her to mutexes, condition variables, thread creation, deadlock avoidance, etc. That’s not a good use of a programmer’s time.
Some common issues with Online prescriptions involve stolen credit card information or defective products, for example those with no http://appalachianmagazine.com/2017/01/28/beware-nationwide-phone-scam-can-you-hear-me-now/ viagra pill price cardiac/kidney/liver issue, but difficulty of receiving a fantastic night time sleep at the proper time? We know you are these in a complicated circumstance. cialis purchase online Treating narcolepsy requires a combination of therapy and medicine. They offer online viagra medicines like kamagra which is also evident from the name, and we have added Tadacip to. The case consist two section of click over here overnight cialis soft the small intestine is also known as the “weekender” due to its long last effects.
What can be done to help a programmer who really does have to run code on multiple cores?

Functional programming languages are a potential solution. The creators of languages like ML, Haskell, and Erlang realized that your compiler can do a lot of fancy things if the programmer isn’t ever allowed to modify a value. If things can’t be modified, then they can be easily parallelized. Once you create an object, as many cores as you want can read it without even bothering to lock it. Of course, this will frustrate a Visual Basic programmer who is used to changing a variable as the object that the variable represents changes. It requires some significantly different programming techniques.

Once again, this is not for everyone.

Futures are a pretty slick way to abstract away threads and some locks. It doesn’t eliminate the headaches of multithreaded programming, but it has the potential to make things simpler.

A future is a chunk of code that a programmer wants to execute. Instead of calling the function that contains the code and waiting for the return value immediately afterwards, the programmer separates the calling and the waiting. First you tell your library that you want your future to run. The library can do whatever it wants at this point. It could execute it immediately. It could put it in a queue to be run by a thread pool. It could ignore it completely. The program can then do whatever it wants. At some point, it may want the result of the future. Then the program will ask the library for the result of the future. The library may have to wait for the result to be ready, but eventually the result will be returned.

The great part about futures is that threads don’t have to be created. If you can divide your program’s logic into N bits, you can let your library and compiler figure out how to use that to speed up the program using multiple cores.

Unfortunately, futures don’t eliminate the need to worry about locks. Since that’s probably a more difficult problem than thread management, futures are not a panacea.

There are some other ways to easily parallelize your code. SQL statements are a great example. Databases are really good at optimizing SQL for this sort of thing.

Intel has a strong interest in making it easier for programmers to use their new chips. Their Thread Building Blocks library uses STL-style algorithms and protected iterator ranges to express parallelism. It also has a “task scheduler” that behaves at least a bit more like a futures library. This seems like a really great idea. An STL-style algorithm that describes the parallelism to the library is not always sufficiently flexible to describe a problem. However, if it is sufficient, it’s extremely easy to use. The task scheduler is more conventional and would probably be much nicer with a good lambda library.

OpenMP is another library designed to abstract away many of the details of parallizing code. It’s not strictly a library, however. It requires some compiler support as well. The programmer uses a function that behaves much like a Unix fork() command. OpenMP then manages several threads to handle the different branches of the fork. While I’m certainly not an expert, this doesn’t seem like either a clean solution or a sufficiently flexible solution.

I’m sure there are other research projects out there. If you know of any interesting ones, please post a comment about it below.

Exploiting an Industry’s Culture

Sometimes, an industry becomes uncreative or stops taking risks. This lets an outsider come in and gain market share by exploiting the mistakes made by an entire industry. It’s fun to look for these industries and understand what they’re doing wrong.

My favorite example is the video game market. (Roger Ehrenberg has a good summary of the Xbox side of this.) Ten years ago, everyone in the video game industry was happy thinking that all gamers were young males. The fact that other people spent enormous amounts of time playing Solitaire and Minesweeper didn’t seem to bother anyone.

Then The Sims came out. This should have been a wakeup call. To a young male such as myself, it was a complete waste of time. To Electronic Arts stockholders, it was gold. That happened in early 2000. Believe it or not, nothing much happened for a long time. People at least talked about why nothing happened, though. It was apparently pretty hard to convince a publisher to risk large amounts of money on something that wasn’t a clone of a successful game. All successful games involved things that young guys like to do. (Solitaire didn’t make any money for Microsoft.)

You can tell where this is going.

The Wii was the next big one. Now you can play bowling and have enough fun doing it that your grandmother will join you. (Trust me, she doesn’t like Halo.) Even so, the industry sat around for a few months saying that the Wii was just a fad and it would be back to young males sometime soon. (The definition of “young” seems to change, though. 35-year-olds play Halo 3.)

I think the video game industry has finally woken up. They’ve given a term to gamers who aren’t young males! That could well be what was missing before. “Casual gamers” don’t like to play first person shooters, and now even Microsoft wants to lure them to the Xbox.

Okay, that’s a story of an industry’s culture having major problems and some companies exploiting that. That story is almost complete. There’s another one that’s happening right now.
Of course, I’m talking about cell phones and the iPhone. Many years ago when I bought my last cell phone, I really wanted a good user interface. Despite spending a lot of time designing user interfaces, I didn’t want to figure out someone else’s bad user interface. There were a lot of them back when I bought mine. The Sony Ericsson collaboration seemed to be doing okay, so I got one.

Apparently my $200 purchase towards a decent UI didn’t motivate the entire industry to work on improving, however. Apple has figured out how to make and sell fashionable and easy-to-use consumer electronics, and they’ve exploited Sharp’s inability to do the same.

Now, it’s still not obvious that the iPhone is a runaway success. It should be noted, however, that everyone at least knows what an iPhone is. I’m a bit jealous of my friends who have them, too. That’s going to help attract buyers to a cheaper phone if Apple came out with one.

The cell phone story isn’t complete, but I’m betting that it’ll end up with Apple doing well. They didn’t do well at first with the iPod, either.
order viagra online Food that includes in this diet are foods like eggs, milk, salmon, broccoli, etc. cialis free samples Anti depressants are medications that can also help regain good health. The unspeakable is actually hidden levitra 40 mg http://icks.org/n/data/ijks/1498534150_add_file_5.pdf away right up until Sunday. How to Buy Effective ED Medications? cheapest tadalafil india or kamagra has become convenient with the online drug suppliers.
Alright, now we’ve talked about the story that’s mostly complete and the story that’s happening right now. What about an industry that has a cultural problem right now but hasn’t yet been exploited? One of the best ways places to look is a small industry that doesn’t have a lot of players in it. If one company is dominating a market, then any cultural issues that that company has could be exploitable by a complete newcomer.

A few of you have probably figured out where I’m going with this one, too.

Is the hardware diagnostics field vulnerable? PC-Doctor is the big player here and we might have some problems. Several potential vulnerabilities might be there.

First, are our diagnostics any good? Well, I happen to know something about our diagnostics. I find it really hard to believe that a newcomer (or even a current player) can do as well here. This is what we do, and we do it well.

Are really good diagnostics what people want, though? Well, it is what companies like HP, Lenovo, Dell, or Apple want on the machines that they ship to their customers. They want to be able to trust those diagnostics, and they can when they run PC-Doctor.

Here’s a potential exploit, though: What do the customers of those big companies want? Do they want fast and trustworthy diagnostics? I don’t think they do. They want something that says that their machine is broken, why it’s broken, and how they should fix it. They don’t care if it works 95% of the time or 99% of the time. They just need it to work this one time.

Furthermore, they don’t care if the problem is hardware or software. That’s a critical question to a PC manufacturer who only warranties hardware defects. That’s not the right question for a lawyer in Florida who wants to know if he should download a new driver or buy a new hard drive. Right now, PC-Doctor doesn’t deal with software issues.

How could this be exploited? Well, suppose a company made some really good software diagnostics. Then they could add some fairly bad hardware diagnostics to it. The big companies might not be impressed by these hardware diagnostics, but the end users might be since the software solves the problem that they want to solve. It would take a new entrant to the diagnostics industry a while to build up a complete set of hardware diagnostics, but they might be able to do it by focusing on what the consumer needs instead of what the big companies need.

I could also be part of the culture that’s screwing up. If that’s the case, then I wouldn’t even know that there was something else wrong. Is our user interface so bad that no consumer would ever use it without a tech support guy telling them what to do? Are we completely unaware of this?

Should I be worried about this? I’d love to hear what you think.

Microsoft is in trouble, and they know it.

This thought has been percolating in my head for a while now, and their most recent actions (in the timeframe of years) only seem to reinforce that idea.

This isn’t the ramble of a hater; I don’t think Microsoft is going to crash because they suck, or write terrible software, or anything like that. There is plenty of history to show that mediocre software can sell fine.

No, the problem, I think, is that Microsoft has run out of ideas. They have tremendous resources, lots of smart people, and lots of good ideas, but somehow that never translates into anything concrete. They are surviving on Windows and Office, with developer tools forming a distant third, but I think they know that story is rapidly coming to a close.

No, Linux isn’t going to take over the desktop, but the very existence of Linux shows us that operating systems are not worth $350 (See Vista Ultimate). In fact what Linux shows us is that over time the operating system will become free. Not today or next year, but within 10 years every copy of Windows will drop to $5, I believe. It isn’t even because Linux is forcing price concessions, it’s because dropping PC prices forces all components, including software, to fall in price. A $2,000 PC can easily support a $99 OS. A $200 PC can probably only support a $5 OS. The fact is that every year PCs are getting cheaper, and the operating system has to keep up. To be fair, Microsoft will make up in volume what they lose in margin, however I think a comparison to Intel is appropriate here.

Approximately 80% of all computers capable of running Windows ships with an Intel processor. Look at Intel’s revenue in 2006: $35b. Compare that with Microsoft’s 2006 revenue: $44b. Yes, Intel also sells NICs, chipsets, FLASH, and Microsoft sells Office, Visual Studio, advertisements, and games. The values are only roughly comparable. However, it seems incongruous that Microsoft is earning more per PC than Intel. Then when you look at their yearly revenue for the past several years and you will see that both grow at roughly 11% to 12% a year, which corresponds neatly to PC growth these past several years. Both companies are strongly tied to PC sales.

So what, you ask? I’ll let Microsoft’s actions speak for themselves now. They have asked their investors to have faith in Microsoft’s Zune, XBox, and Live initiatives. Or put another way, that Microsoft’s future lay in markets dominated by Apple, Sony (soon Nintendo), and Google. A lot of people scoff because Apple or Google is so insignificant in size compared to Microsoft. The surprise is when you look at the relative growth of each company:
Old locks might develop mechanical snags anytime hence they are brand levitra online quite worried about their sexual life and relationship as well. Include this great carbohydrate in the daily food. cheap viagra no prescription Around 50% prices for viagra of men after the age of 50 years. Infertility – An Overview: no prescription cialis If you and your partner as well.
Apple’s revenue growth between 2005-2006 was $5.4b, Microsoft’s was $4.5b, and Google’s was 4.5b. Microsoft has already released that their revenue grew by $6.9b this year, a nice healthy increase, but I’m sure management is still worried that Apple and Google will continue to eclipse them.

So what is happening? Apple, Sony, and Google have tapped into revenue streams that Microsoft has missed; consumer electronics, video games, and advertisement, and Microsoft is desperate to diversify into these markets to blunt the continued slowing PC growth. Worldwide growth of PCs is still strong, still healthy, but again falling PC prices and rampant piracy means that Microsoft doesn’t have as strong a presence as they want.

However, and this is why Microsoft is in trouble, unlike their past battles with Netscape, Apple, or Palm, Google, Nintendo, and Apple have shown no signs of faltering. Microsoft only has sold 1m Zunes since release, compared to nearly 40m iPods (which is about 2.5%, more or less Apple’s PC market share worldwide). Microsoft only has 13% Live market share, which would be a great number except that Microsoft is third, behind Yahoo! at 19% and Google at over 60%. Then there is the console battle; Microsoft originally targeted Sony’s PS2 and PS3 and lost sight of Nintendo, who’s Wii seems to be on target to become number one.

So can Microsoft recover? I think so, but they have to stop putting the cart in front of the horse. Stop thinking about ad revenue and instead create the best online service possible, stop thinking about game licenses and price points and create the most incredibly fun games possible, stop thinking about music and video licenses, DRM and media formats, and create the most incredibly desirable consumer electronics possible.

The rest will come, I think, if Microsoft can focus on making the best product possible instead of a +1 product; Live is Google+1, Zune is iPod+1, and the XBox is a Playstation+1.

Explanations in user interfaces are bad!

When I was doing the design for the BTO Support Center website, I had some troubles explaining to some coworkers why helpful text shouldn’t be added to explain the interface. At the time, I couldn’t explain it well, but now that I’ve thought about it a while, I think I have a better way to describe it.

My new argument assumes that the interface is explorable. Let’s start with that.

If a user is comfortable with a user interface, they will happily play with it until they get it to do what they want. This is called an explorable interface, and it’s required in any good interface. For example, I’m typing this on the blogging software’s built in editor. I’ve never used this editor before, but the cost of just pushing buttons randomly on it is low. I can undo them easily, so I’m not worried about pushing the wrong thing. The editor doesn’t normally pop up a useless dialog box that I have to get rid of, so pushing the wrong button is unlikely to waste much of my time. It is laid out in a way that explains what buttons are relevant, so I don’t even have to scan most of the web page. The cost of not knowing what I’m doing is low, so I’ve never read most of the text on the page.

The economist Herbert Simon described this behavior as “satisficing“. This is a combination of satisfy and suffice, and Herbert Simon used it to describe people’s behavior when confronted with a choice that is expensive to resolve. If the cost of reading an entire web page to find the optimal solution is expensive, then people are perfectly happy to use the first thing they find that might work. The interface designer has to do a lot of work to make sure that the first thing they find is the correct one.
Fildena is the most recommended and widely used cialis 20mg generika brand for treating the condition of erectile dysfunction (ED) or impotence in most males: ? A man is able to gain harder and bigger erection to please her in bed for more than five minutes. This is why the dosage sildenafil for women for each erectile brokenness men. An erection is a resulting effect of plentiful blood viagra without side effects flow near the targeted area. Nitrates and vardenafil must not be used concomitantly. sildenafil uk check my page
In an explorable user interface, users don’t have to figure out exactly what the designer was thinking. They don’t have to read every bit of text on the dialog. They can just pick a button that might do what they want and push it. This, it turns out, is often substantially cheaper than trying to understand the interface completely. After all, you can just undo it afterwards.

Once you understand this, a bit of text to describe your interface is clearly the wrong answer. A user will not actually read the text on the web page if exploring might work. If exploring doesn’t work, the user will become frustrated rather than resorting to your helpful bit of text. In some cases, they will be perfectly happy to assume that your interface doesn’t support the option they were hoping to find.

Don’t explain your interface. Make it easy to explore.

Confusing USB Mass Storage disks and flash memory

A question I was recently asked was, “why isn’t the latest PC-Doctor for Linux release able to distinguish the differences between a USB flash drive and USB hard drive?” The answer is a bit interesting and ultimately boils down to a rather loose specification. To understand the problem, it helps to understand how USB mass storage devices work. USB mass storage devices, whether they are flash drives, hard drives, digital cameras, CDROMs, or DVD players, generally implement a small subset of SCSI commands. These commands are sent to the USB device via a special command block called a USB Request Block (URB). It is a very difficult task to properly implement the various SCSI standards and command sets properly in, and since most hardware and firmware designers want to keep development costs minimal, they often chose to only implement the commands required to make a device function. Even commands designated as MANDATORY in the SCSI specifications often go unimplemented or only partially implemented in the firmware of these devices.

There are a few SCSI commands which seem to be consistently implemented. They are listed below:

  • INQUIRY
  • REQUEST SENSE
  • READ CAPACITY
  • READ (10)
  • WRITE (10)
  • TEST UNIT READY

One needs to understand as to why these drugs cause sexual disorders? A majority of Antidepressants works to elevate levels of neurotransmitter online levitra india serotonin and this rise in serotonin levels leads to a negative impact upon the desire and arousal phase of our sexual response cycle. This sort of medicine is only proposed for the men, so a woman get viagra no prescription must not dare to take it. Erectile dysfunction or ED or impotence steals the happiness from tadalafil discount the life of its victim. Sometimes a buy viagra uk chemical or compound designed to treat one of the most common problems in men during intercourse.
The only command relevant to our discussion is the INQUIRY command. This command is described in the SCSI Primary Command Set. This command instructs the device to send the computer information describing the device and its logical unit. The returned data conforms to the Standard INQUIRY data format and contains the following information that is of interest to most users:

  • Peripheral Device Type – This field is generally set to 0x00 (Disk), 0x05 (CD/DVD device), 0x0E (some disks).
  • Removable Media Bit (RMB) – This bit field can be true (1) or false (0). When set true, the medium or disk is supposed to be removable. When set to false, the medium is not removable.
  • Vendor Identification – A string of 8 characters which uniquely identify the vendor of the device. Each vendor is assigned a string by INCITS.
  • Product Identification – This field contains 16 ASCII characters that the vendor can name their device.
  • Product Revision Level – This field contains 4 ASCII characters which the vendor can use to distinguish different revisions of their product.

There is a lot more information provided by the INQUIRY data, but the only field relevant to our discussion is the Removable Media Bit.

Most USB hard drives are actually ATA or SATA disks, hidden behind what’s called a USB-ATA or USB-SATA bridge chip. This chip translates USB and SCSI commands into the appropriate command for the enclosed disk, whether it be ATA or SATA. These chips generally say that their medium is not removable, because it is a âÂ?Â?fixedâÂ?Â? disk and you cannot easily replace the enclosed hard drive while the USB device is plugged in.

Most USB flash drives, on the other hand, identify themselves as having removable mediums, thus setting the RMB bit to true.

So let’s go back to the original question: Why isn’t PC-Doctor for Linux able to distinguish the differences between a USB flash drive and USB hard drive?

With your understanding of the above-described Removable Media Bit, you might say âÂ?Â?well, just say it’s a hard drive if the RMB is set false and say it’s a flash drive if the RMB is set true.âÂ?Â? Flash drives are manufactured to falsely report their media is removable, even if its soldered to their circuit board. You’d be right, your solution would work … to a degree.

Well, the proposed solution works only sometimes. There are devices out there which correctly identify themselves as not being removable, for example the Sandisk uDiskOnChip Embedded USB Flash Disk, which actually identifies itself truthfully by setting the RMB to false.

In such a case, the proposed solution would identify the uDiskOnChip as being a hard disk, which would make the PC-Doctor product look a little bit stupid for falsely identifying a device as something it isn’t. So for the Linux product, we decided that it was better to not ask the question âÂ?Â?is it a hard drive or flash disk?âÂ?Â? and instead just call it simply a âÂ?Â?USB mass storage deviceâÂ?Â?.

While some consumers may find it confusing that we call their thumb/pen drive or USB hard drive a USB mass storage device instead of just a �flash disk� or �hard disk�, we are trying to be as accurate as possible given that there are no other standardized ways which we can use to distinguish differences.

For more information:

« Older posts Newer posts »