Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filling bigarrays may block out runtime #4832

Closed
vicuna opened this issue Jul 3, 2009 · 5 comments
Closed

Filling bigarrays may block out runtime #4832

vicuna opened this issue Jul 3, 2009 · 5 comments

Comments

@vicuna
Copy link

vicuna commented Jul 3, 2009

Original bug ID: 4832
Reporter: @mmottl
Status: closed (set by @damiendoligez on 2015-03-17T16:08:23Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.11.0
Target version: 4.03.0+dev / +beta1
Fixed in version: 4.03.0+dev / +beta1
Category: otherlibs
Monitored by: matt @yallop @hcarty @Chris00 @mmottl

Bug description

Though bigarray data lives on the C-heap, the bigarray fill function does not release the OCaml-lock when overwriting it. This may block out the runtime from handling signals or executing other threads. If a large bigarray is memory-mapped, this can lead to many seconds of unresponsiveness.

@vicuna
Copy link
Author

vicuna commented May 31, 2011

Comment author: @damiendoligez

There is a trade-off between the cost of releasing the lock (which can be too high for small bigarrays) and the latency when not releasing it (which can be too high for large bigarrays).
We should probably release the lock only when the bigarray is bigger than some threshold.

@vicuna
Copy link
Author

vicuna commented May 31, 2011

Comment author: @mmottl

Besides taking the size into account for determining when to release the lock, we should also check whether the bigarray was memory-mapped, in which case the lock should also be released, I think.

@vicuna
Copy link
Author

vicuna commented Jun 11, 2013

Comment author: @mmottl

Btw., this issue also affects the "blit" bigarray function, but apparently no others besides "fill".

@vicuna
Copy link
Author

vicuna commented Jan 30, 2014

Comment author: @mmottl

I have just submitted a pull request for a patch solving this issue to the "official" Github repository here: #4

@vicuna
Copy link
Author

vicuna commented Mar 17, 2015

Comment author: @damiendoligez

Fixed in trunk (rev 15947).

@vicuna vicuna closed this as completed Mar 17, 2015
@vicuna vicuna added this to the 4.03.0 milestone Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant