Commit Graph

29 Commits

Author SHA1 Message Date
David Anderson a3649ebe09
Merge pull request #3984 from BOINC/cf_remove_obsolete_code
Cf remove obsolete code (no functional changes)
2020-08-28 12:54:29 -07:00
David Anderson f616edc60a client and wrapper: fix process priority mismatch
It turns out we have two different encodings of process priority:
1) specified in cc_config.xml and used by the client: 0 (low) to 4 (high)
2) specified in job.xml and used by the wrapper: 1 (low) to 5 (high).

This didn't cause any problems until recently when I added code
to pass the cc_config.xml info to the wrapper;
it was interpreting it on the 1-5 scale.

Fix: have the wrapper convert it (add one).

Also: I forgot to have the client actually put the priority into
in the app_init_data.xml file.
2020-08-27 23:20:12 -07:00
Charlie Fenton f451430bab Update copyright dates in source files I recently modified 2020-08-26 01:10:14 -07:00
David Anderson ac4b390ee8 client/manager, Win: remove references to _STDWX_H_; not used anymore 2020-06-04 00:48:21 -07:00
Kevin Reed a6246689aa
Merge pull request #3045 from BOINC/wrapper_sig
Changed SIGSTOP to SIGTSTP
2019-04-11 12:06:33 -05:00
lfield d1e8a38770 Changed SIGSTOP to SIGTSTP 2019-03-06 17:03:13 +01:00
David Anderson 1897ccb0e9 Merge branch 'dpa_suspend_threads' of github.com:BOINC/boinc into dpa_suspend_threads 2018-12-23 20:44:41 -08:00
David Anderson 42d42ebdeb Remove incorrect comment. 2018-12-23 20:43:20 -08:00
David Anderson d36e718159 fix uninitialized var 2018-11-05 13:09:43 -08:00
David Anderson 09c1422ba0 API and wrapper: fix possible race condition when throttling multithread apps
To quote from comments in lib/proc_control.cpp:
// The only way to do this on Windows is to enumerate
// all the threads in the entire system,
// and identify those belonging to one of the processes (ugh!!)
//
// In the suspend case, this creates a potential synch problem:
// - CPU throttling sends suspend message
// - we enumerate threads
// - one of those threads creates a new thread T
// - we suspend the enumerated threads
//
// In this case, T will run, which is undesirable but not an error.
// But suppose that
// - the app uses a mutex,
// - at the start of the above sequence some thread holds the mutex
// - T immediately tries to acquire the mutex (and is suspended).
// Then when the client sends a resume message,
// T resumes and there are two threads in the mutex section. Error!
//
// There are a couple of solutions to this.
// 1) enumerate all the threads twice.
// 2) have suspend() make a record of the threads it suspends,
//    and have resume() resume only these threads.
//
// 1) doubles the overhead, so I'm going with 2) for now.
2018-11-05 12:54:59 -08:00
David Anderson 317dc915b0 wrapper: let job.xml specify the process priorities of sub-tasks
Add optional <priority>N</priority> to <task> element to job.xml.
Lets you specify the process priority of the task;
in particular, task can run at high priority.
Apparently this is needed to make bitcoin ASIC apps perform well.
2014-10-13 11:35:16 -07:00
Charlie Fenton 68f0492d69 lib: Fix build break on Linux when building with --enable-debug 2014-06-24 04:52:49 -07:00
David Anderson 0fc0f80c30 Fix win compile warnings. Let's shoot for zero warnings, OK? 2013-11-11 10:42:03 -08:00
David Anderson 17a4ab8db9 David 11 Dec 2012
- Win process control (affects API and wrapper):
		Since Win doesn't have an API for process suspend/resume,
		we were suspending processes by
			1) enumerating all the threads in the system (typically several thousand)
			2) suspending those belonging to the given process
		The problem: for each thread, the code was calling a function
		in diagnostics_win.cpp to see if the thread was exempted from suspension.
		This check (which is unnecessary anyway if we're suspending another process)
		was surrounded by a semaphore acquire/release.
		The result: performance problems.
		It could take a minute to suspend the threads.
		Solution:
			1) do the check for exemption only if we're suspending threads
				in our own process (i.e. from the API)
			2) if we're suspending multiple processes, enumerate the threads
				only once, and see if each one belongs to any of the processes
			3) have the wrapper elevate itself to normal priority.
				Otherwise it can get preempted for long periods,
				sometimes in the middle of scanning the threads.
		Note: post-9x versions of Win have a process group API that includes suspend/resume.
		We'll switch to this soon.
2013-03-04 17:02:40 +01:00
David Anderson 7d40c46923 - client and API: improve the way an app checks for the death of the client
Old: heartbeat mechanism
    Problem: if the client is blocked for > 30 secs
        (e.g. because it takes a long time to write the state file,
        of because it's stopped in a debugger)
        then apps exit.
        This is bad is the app doesn't checkpoint and has been
        running for a long time.
    New: the client passes its PID to the app.
        The app periodically (10 sec) checks that the process still exists.
    Notes:
    - For backward compatibility (e.g. new API w/ old client,
        or vice versa) the client still sends heartbeats,
        and the API checks heartbeats if the client doesn't pass a PID.
    - The new mechanism works only if the client's PID isn't assigned
        to a new process within 10 secs of the client exiting.
        Windows 2000 reuses PIDs immediately, so check for Win2K
        and don't use this mechanism if so.

TODO: For Unix multithread apps,
    critical sections aren't currently being enforced.
    Need to fix this by masking signals.


svn path=/trunk/boinc/; revision=26147
2012-10-11 16:41:31 +00:00
David Anderson 53782b7de4 - lib: switch include order to the way it was (general to specific).
Should fix MinGW compile


svn path=/trunk/boinc/; revision=26008
2012-08-11 05:47:18 +00:00
David Anderson 405f567c81 - code cleanup: in foo.cpp, include foo.h first
svn path=/trunk/boinc/; revision=25933
2012-08-01 20:04:05 +00:00
David Anderson 68b3fe6b19 - client: fix crashing bug when there's a cycle in the process graph.
I had fixed this in one place but not another.
- client: don't memset(0,) a PROCINFO; use clear() instead


svn path=/trunk/boinc/; revision=24431
2011-10-19 07:49:23 +00:00
David Anderson 80a6db29d6 - client: win compile fixes
svn path=/trunk/boinc/; revision=24330
2011-10-04 18:19:57 +00:00
David Anderson 32583581ac - manager: fix build break on Linux
Undoes part of yesterday's checkin.
- more changes from #ifdef HAVE_X to #if HAVE_X


svn path=/trunk/boinc/; revision=24307
2011-09-28 17:33:26 +00:00
David Anderson 3eabc15a84 - lib: minor code shuffle
svn path=/trunk/boinc/; revision=24126
2011-09-02 22:06:30 +00:00
Charlie Fenton b042ad7b42 lib: Fix compile errors; add app_control.cpp to XCode project
svn path=/trunk/boinc/; revision=24125
2011-09-02 21:54:35 +00:00
David Anderson 4778836022 - Win compile fixes
svn path=/trunk/boinc/; revision=24122
2011-09-02 18:47:15 +00:00
David Anderson ac67e5c5ee - code shuffle
svn path=/trunk/boinc/; revision=24121
2011-09-02 18:32:32 +00:00
David Anderson 8ad9d7d98b - more code shuffling:
proc_control: controlling processes
    procinfo: enumerating and querying processes
    run_app_windows: launching apps as other users on Win


svn path=/trunk/boinc/; revision=24120
2011-09-02 18:23:13 +00:00
David Anderson ecf614812e - code shuffling
svn path=/trunk/boinc/; revision=24119
2011-09-02 18:04:10 +00:00
Rom Walton 9cb3e6ffc7 - client & lib: bring header inclusion up-to-date for the CC to begin
hunting down a memory leak.
        
    client/
        <Various Files>
    lib/
        <Various Files>

svn path=/trunk/boinc/; revision=21457
2010-05-11 19:10:29 +00:00
Rom Walton 28c72cab79 - WIN: First pass through the code to fix compliation errors when
building in a Unicode enabled environment.
        
        NOTE: For files that are shared between the core client and
          the manager, it was simpliar to just call the ANSI versions
          of the specific Windows API functions then to monkey with
          all of the string handling code and convert between ANSI
          and UCS-2 strings.  CreateFile becomes CreateFileA instead
          of the default of CreateFileW.
          
        Down to 11 compile time errors from over 100.

    clientgui/
        BOINCBaseFrame.cpp
        BOINCTaskBar.cpp
        browser.cpp
        browser.h
        sg_StatImageLoader.cpp
    lib/
        boinc_win.h
        diagnostics_win.cpp
        filesys.cpp
        gui_rpc_client_ops.cpp
        proc_control.cpp
        stackwalker_imports.h
        stackwalker_win.cpp
        str_util.cpp
        util.cpp
        win_util.cpp, .h

svn path=/trunk/boinc/; revision=17859
2009-04-23 03:40:49 +00:00
David Anderson 98cfb8d3b0 - rename .C files to .cpp so that Doxygen will work
svn path=/trunk/boinc/; revision=16069
2008-09-26 18:20:24 +00:00