Re: moving data from one place to another in a text file
From: Richard (riplin_at_Azonic.co.nz)
Date: 03/03/05
- Previous message: Robert Wagner: "Re: RW refuses to admit his error(was: moving data from one place to another in a text file"
- In reply to: jce: "Re: moving data from one place to another in a text file"
- Next in thread: Robert Wagner: "Re: moving data from one place to another in a text file"
- Reply: Robert Wagner: "Re: moving data from one place to another in a text file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 3 Mar 2005 00:43:04 -0800
> One concern then would be the correct management and overhead of
ensuring
> each word is pulled only once from the queue.
That is what locks are for. Only one thread can pull a word from the
queue at a time.
I did write a printer buffering system nearly 20 years ago which used
multi-threading (actually it had to use full processes but running in
the same code and data segments) because it had to monitor multiple
i/o. It used a circular buffer and had to toggle locks to ensure the
buffer was kept uncorrupted.
> Now we're reaching a compromise where we could agree that
> perhaps RW's thread solution is not so wrong.
As is usual with RW he vastly overstates and hyperbolises. He states,
for example, that multi-threading will save resources, but it does this
only in the very narrow areas where many CPUs are available and
otherwise unused. In fact as there will be many more cycles used up,
not just by the extra code but also by the scheduler it will use _more_
resources. 'Saving' resources when nothing else will use them is
pointless. Wasting resources when other processes are trying to share
them is also pointless.
Most multi-CPU systems are servers and designated to run server
software and multiple streams. Even desktops are not just running a
single task, not since MS-DOS of 15 years ago. I have a Linux desktop
for development and while I am typing here 'top' shows 160 tasks
running, though the vast majority are sleeping.
If you have multiple CPUs then run multiple streams. The OS will be
processing the filesystem cache, the database will use multiple CPUs.
The servers that I look after have multiple users and run several X
desktops (to LTSP diskless graphic terminals) plus each user runs
several copies of applications. Typically there are several hundred
tasks.
You may note that RW's machines are corporate servers (not desktops) on
which he specifically closed down all other services to run his test.
The idea that one program should grab every resource available should
have died with MS-DOS.
There _are_ good reasons for multi-threading, such as having many
threads having to wait for different responses, and this may apply to
database systems or web servers.
RW has made many overstatements about where it can be used and when.
> forces you to think about problems in a different manner.
The hard bit is when RW has his steel trap mind closed around a subject
getting him to think about it in a different manner.
- Previous message: Robert Wagner: "Re: RW refuses to admit his error(was: moving data from one place to another in a text file"
- In reply to: jce: "Re: moving data from one place to another in a text file"
- Next in thread: Robert Wagner: "Re: moving data from one place to another in a text file"
- Reply: Robert Wagner: "Re: moving data from one place to another in a text file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|