Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #16695
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Joshua Cranmer <Pidgeot18@verizon.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: How can you make idle processors pick up java work? |
| Date | Mon, 30 Jul 2012 19:51:23 -0400 |
| Organization | A noiseless patient Spider |
| Lines | 28 |
| Message-ID | <jv76m4$eja$1@dont-email.me> (permalink) |
| References | <jv759b$s7$1@speranza.aioe.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Mon, 30 Jul 2012 23:51:32 +0000 (UTC) |
| Injection-Info | mx04.eternal-september.org; posting-host="5f536c15fdfd3b7c57128c819c23bc89"; logging-data="14954"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ZaGHZUXUVmIcXF0Gajr9PbFeQB0rsK3w=" |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0 |
| In-Reply-To | <jv759b$s7$1@speranza.aioe.org> |
| Cancel-Lock | sha1:RSfgrpBU49h+EGS7kFNKQkPlb3U= |
| Xref | csiph.com comp.lang.java.programmer:16695 |
Show key headers only | View raw
[Gah, your newsreader is incapable of threading posts correctly. Please find a non-broken one.] On 7/30/2012 7:27 PM, qwertmonkey@syberiaoutpost.ru wrote: >>> Is there a way to make these processors pick up/share work also, or >>> do you have to use some sort of scheduling framework on top of java? > >> Use multiple threads? > ~ > a) I need to actually scan large text files (10+ million lines). > b) On each line there is a NL sentence. > c) That processing should be run only once, but as fast as possible. Only 10M-line files? The easiest way to do this is to just make a ThreadPoolExecutor and have your main thread dispatch requests as fast as possible to the pool. Or you can do the work pooling yourself, which may be faster since you're not continually posting Runnable's, but timing results would be necessary to convince me. There are other options, but chances are, your disk drive is going to saturate first (in short, it involves reading non-consecutive pages of the file, which is generally a recipe for disaster). -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How can you make idle processors pick up java work? qwertmonkey@syberiaoutpost.ru - 2012-07-30 23:27 +0000 Re: How can you make idle processors pick up java work? David Lamb <dalamb@cs.queensu.ca> - 2012-07-30 19:34 -0400 Re: How can you make idle processors pick up java work? Patricia Shanahan <pats@acm.org> - 2012-07-30 16:40 -0700 Re: How can you make idle processors pick up java work? Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-07-30 19:51 -0400 Re: How can you make idle processors pick up java work? "John B. Matthews" <nospam@nospam.invalid> - 2012-07-30 23:45 -0400
csiph-web