multithreading

Task.Run doesn't execute [closed]

孤人 提交于 2020-04-17 22:01:16
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 9 days ago . My 64bit application uses Tasks a lot and now I appear to have a situation in which Task.Run isn't executed. The ThreadPool has 32768 threads AFAIK and I cannot imagine that all of these are used. What could prevent Task.Run from executing? And how can I diagnose the problem? UPDATE Before reading

Task.Run doesn't execute [closed]

点点圈 提交于 2020-04-17 21:58:43
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 9 days ago . My 64bit application uses Tasks a lot and now I appear to have a situation in which Task.Run isn't executed. The ThreadPool has 32768 threads AFAIK and I cannot imagine that all of these are used. What could prevent Task.Run from executing? And how can I diagnose the problem? UPDATE Before reading

Properly setting up a simple server-side cache

你离开我真会死。 提交于 2020-04-16 05:35:54
问题 I'm trying to set up a server-side cache properly and I'm looking for constructive criticism on the setup I have currently. The cache is loaded when the Servlet starts and never changed again, so in effect it's a read-only cache. It obviously needs to stay in memory for the lifetime of the Servlet. Here's how I have it set-up private static List<ProductData> _cache; private static ProductManager productManager; private ProductManager() { try { lookup(); } catch (Exception ex) { _cache = null;

Properly setting up a simple server-side cache

∥☆過路亽.° 提交于 2020-04-16 05:33:10
问题 I'm trying to set up a server-side cache properly and I'm looking for constructive criticism on the setup I have currently. The cache is loaded when the Servlet starts and never changed again, so in effect it's a read-only cache. It obviously needs to stay in memory for the lifetime of the Servlet. Here's how I have it set-up private static List<ProductData> _cache; private static ProductManager productManager; private ProductManager() { try { lookup(); } catch (Exception ex) { _cache = null;

Signal SIGSTOP received, but no signal handler set in perl script

☆樱花仙子☆ 提交于 2020-04-16 04:59:31
问题 I have the following code in my perl script which somehow doesn't seem to work: my $thr; sub start__server_thread() { $thr = threads->create(\&iperf_start_server, $_[0], $_[1], $_[2]); print("Value of thread is $thr\n"); &START_SERVER_RESPONSE($controller_ip, $controller_port, "success", 2345, $_[1]); } sub iperf_start_server() { # Do some stuff here and then handle the signal $SIG{'SIGSTOP'} = sub { print("Stop signal received\n"); $thr->exit(); $flag = 1; }; } sub stop_server() { my ($dat,

Signal SIGSTOP received, but no signal handler set in perl script

妖精的绣舞 提交于 2020-04-16 04:59:09
问题 I have the following code in my perl script which somehow doesn't seem to work: my $thr; sub start__server_thread() { $thr = threads->create(\&iperf_start_server, $_[0], $_[1], $_[2]); print("Value of thread is $thr\n"); &START_SERVER_RESPONSE($controller_ip, $controller_port, "success", 2345, $_[1]); } sub iperf_start_server() { # Do some stuff here and then handle the signal $SIG{'SIGSTOP'} = sub { print("Stop signal received\n"); $thr->exit(); $flag = 1; }; } sub stop_server() { my ($dat,

Android MultiThreading with TextWatcher

拟墨画扇 提交于 2020-04-16 04:58:05
问题 I'm fairly new to Android development and am currently working on an app that allows people to type text into a box and the text is displayed on a Bitmap on screen. I have a text box in the activity that listens for changes. Each time you type text it calls functions to figure out how to best format the text on the image, then updates the image with the new text. It works fine for just a little bit of text, but when there's a lot, the calculations become slower and the device begins to freeze

Lock vs synchronized vs atomic variables vs volatile in java in terms of read-write atomicity, visibility and protection from reordering

萝らか妹 提交于 2020-04-16 03:38:09
问题 I read following about volatile from the book Java Concurrency in Practice: When a field is declared volatile, the compiler and runtime are put on notice that this variable is shared and that operations on it should not be reordered with other memory operations. Volatile variables are not cached in registers or in caches where they are hidden from other processors, so a read of a volatile variable always returns the most recent write by any thread. The visibility effects of volatile variables

Understanding atomic-ness, visibility and reordering of synchonized blocks vs volatile variables in Java

倖福魔咒の 提交于 2020-04-16 02:53:25
问题 I am trying to understand volatile keyword from the book Java Concurrency in Practice. I compares synchronized keyword with volatile variables in three aspects: atomic-ness, volatility and reordering. I have some doubts about the same. I have discussed them one by one below: 1) Visibility: `synchronized` vs `volatile` Book says following with respect to visibility of synchronized : Everything thread A did in or prior to a synchronized block is visible to B when it executes a synchronized

Ways to detect deadlock in a live application

送分小仙女□ 提交于 2020-04-15 03:15:11
问题 What are the ways to detect deadlocks in a live multi-threaded application? If we found there is a deadlock, are there any ways to resolve it, without taking down/restarting the application? 回答1: There are two popular ways to detect deadlocks. One is to have threads set checkpoints. For example, if you have a thread that has a work loop, you set a timer at the beginning of doing work that's set for longer than you think the work could possibly take. If the timer fires, you assume the thread