Re: moving data from one place to another in a text file
From: Robert Wagner (spamblocker-robert_at_wagner.net)
Date: 03/04/05
- Next message: Pete Dashwood: "Re: OT: Religion in CLC posts WAS: Re: MF Collection Class speed"
- Previous message: Jeff York: "Re: OT: Religion in CLC posts WAS: Re: MF Collection Class speed"
- In reply to: Richard: "Re: moving data from one place to another in a text file"
- Next in thread: Richard: "Re: moving data from one place to another in a text file"
- Reply: Richard: "Re: moving data from one place to another in a text file"
- Reply: docdwarf_at_panix.com: "Re: moving data from one place to another in a text file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 04 Mar 2005 00:44:48 GMT
On 3 Mar 2005 00:43:04 -0800, "Richard" <riplin@Azonic.co.nz> wrote:
>> 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.
Don't use a single queue. Create a queue per thread. Think of the
parser as a dealer distributing cards to the multiple players. The
only locks required are on the last card in each pile.
>> 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.
Every mainframe, server and (soon) desktop is not a very narrow area.
>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.
Whether other processes are trying to share can only be known at
execution time .. and mediated by the operating system. Making
ASSumptions about other processes at design time is the path to
wasting idle resources.
>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.
It shows 160 processes, not threads. Run 'glance' to see how much
multithreading is going on. Your Java processes will typically show
50-100 threads each.
>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.
No I didn't. The other services happened to be idle.
>The idea that one program should grab every resource available should
>have died with MS-DOS.
The idea that program designers should second-guess execution-time
workload should have died with single-processor mainframes.
>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.
Tell it to Java and databases, both of which routinely multithread a
single transaction.
>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.
The word is 'resolute'. Remember: the Marine Corps symbol is a
bulldog. :)
- Next message: Pete Dashwood: "Re: OT: Religion in CLC posts WAS: Re: MF Collection Class speed"
- Previous message: Jeff York: "Re: OT: Religion in CLC posts WAS: Re: MF Collection Class speed"
- In reply to: Richard: "Re: moving data from one place to another in a text file"
- Next in thread: Richard: "Re: moving data from one place to another in a text file"
- Reply: Richard: "Re: moving data from one place to another in a text file"
- Reply: docdwarf_at_panix.com: "Re: moving data from one place to another in a text file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|