Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7196773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:50:31+00:00 2026-05-28T20:50:31+00:00

user=> (.. Runtime getRuntime availableProcessors) 2 And evaluating this example: http://clojuredocs.org/clojure_core/clojure.core/pmap#example_684 I get user=>

  • 0
user=> (.. Runtime getRuntime availableProcessors)
2

And evaluating this example: http://clojuredocs.org/clojure_core/clojure.core/pmap#example_684 I get

user=> (time (doall (map long-running-job (range 4)))) 
"Elapsed time: 12000.621 msecs"
(10 11 12 13)
user=> (time (doall (pmap long-running-job (range 5))))
"Elapsed time: 3000.454 msecs"
(10 11 12 13 14)
user=> (time (doall (pmap long-running-job (range 32))))
"Elapsed time: 3014.969 msecs"
(10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 3839 40 41)
user=> (time (doall (pmap long-running-job (range 33))))
"Elapsed time: 6001.526 msecs"
(10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42)

I wonder why I have to pass 33 to wait 33 sec. for result. pmap create 2 (available processors) + 2 threads, yes? I suppose that when pass (range 5) it will be executed in 6 sec. Why it is different?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T20:50:32+00:00Added an answer on May 28, 2026 at 8:50 pm

    Actually pmap does not obey the “processors + 2” limit. That’s a result of the ways in which the regular map and the future macro work:

    1. future uses a cached thread pool which has no size limit;

    2. map produces a chunked sequence, that is, one which is always forced 32 elements at a time, even if only a handful at the beginning of a chunk are actually consumed by the caller.

    The ultimate result is that futures in pmap are launched in parallel in blocks of 32.

    Note that this is not in violation of the contract specified in pmap‘s docstring. The code, on the other hand, might lead one to believe that it was intended that the “processors + 2” limit be respected — as it would if map was written naively. In fact, pmap might well predate the move to chunked seqs, although I’m not really sure, it’s been a while.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The number of query conditions is determined by user selections at runtime, ie var
I'm trying to do something that gets a cs file in runtime from user
Where do you store user-specific and machine-specific runtime configuration data for J2SE application? (For
How to let the end user draw shapes at runtime on bing maps (Virtual
I am now working on changing android theme style at runtime, when the user
I ran the following method Runtime.getRuntime().maxMemory() and gave 85196800. However, I then ran top
In a Java application: currentProcess = Runtime.getRuntime().exec(MyWindowsApp.exe); ... currentProcess.destroy(); Calling destroy simply kills the
I'm using Runtime.getRuntime().exec(String[]) to run processes where some of the elements of the String
Does anyone know why these two statements result in the shown exception? Runtime.getRuntime().exec(assoc .vlan=\file
when I run this command ffmpeg -i C:\user\test.wmv >C:\user\test.wmv_info.txt 2>&1 from command prompt it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.