2005-01-20 23:22:22 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2005 University of California
|
2003-08-01 23:40:16 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation;
|
|
|
|
// either version 2.1 of the License, or (at your option) any later version.
|
2003-08-01 23:40:16 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This software is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
2002-12-03 18:57:40 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// To view the GNU Lesser General Public License visit
|
|
|
|
// http://www.gnu.org/copyleft/lesser.html
|
|
|
|
// or write to the Free Software Foundation, Inc.,
|
|
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2002-12-03 18:57:40 +00:00
|
|
|
|
2004-08-21 19:03:12 +00:00
|
|
|
// The structure of the memory segment shared between
|
|
|
|
// the feeder and schedulers
|
|
|
|
// This is essentially a cache of DB contents:
|
|
|
|
// small static tables like app_version,
|
|
|
|
// and a queue of results waiting to be sent.
|
|
|
|
|
2003-04-07 19:06:00 +00:00
|
|
|
#include "boinc_db.h"
|
2002-05-30 07:14:21 +00:00
|
|
|
|
2002-12-03 18:57:40 +00:00
|
|
|
// the following must be at least as large as DB tables
|
2004-09-24 20:17:52 +00:00
|
|
|
// (counting only non-deprecated entries for the current major version)
|
2002-12-03 18:57:40 +00:00
|
|
|
// Increase as needed
|
|
|
|
//
|
2002-05-30 07:14:21 +00:00
|
|
|
#define MAX_PLATFORMS 50
|
|
|
|
#define MAX_APPS 10
|
2004-09-24 20:17:52 +00:00
|
|
|
#define MAX_APP_VERSIONS 50
|
2004-09-02 17:14:03 +00:00
|
|
|
|
|
|
|
// If you increase this above 100,
|
|
|
|
// you may exceed the max shared-memory segment size
|
|
|
|
// on some operating systems.
|
|
|
|
#define MAX_WU_RESULTS 100
|
|
|
|
//#define MAX_WU_RESULTS 500
|
2004-02-05 21:35:48 +00:00
|
|
|
|
2006-01-19 21:46:25 +00:00
|
|
|
// values of WU_RESULT.state
|
2004-04-04 01:59:47 +00:00
|
|
|
#define WR_STATE_EMPTY 0
|
|
|
|
#define WR_STATE_PRESENT 1
|
2006-01-19 21:46:25 +00:00
|
|
|
// If neither of the above, the value is the PID of a scheduler process
|
2004-08-31 23:08:28 +00:00
|
|
|
// that has this item reserved
|
2004-04-04 01:59:47 +00:00
|
|
|
|
2002-05-30 07:14:21 +00:00
|
|
|
// a workunit/result pair
|
|
|
|
struct WU_RESULT {
|
2004-04-04 01:59:47 +00:00
|
|
|
int state;
|
2003-09-21 21:00:25 +00:00
|
|
|
int infeasible_count;
|
2006-07-11 21:49:20 +00:00
|
|
|
bool need_reliable; // try to send to a reliable host
|
2002-05-30 07:14:21 +00:00
|
|
|
WORKUNIT workunit;
|
2004-05-17 17:24:14 +00:00
|
|
|
int resultid;
|
2006-05-02 22:17:09 +00:00
|
|
|
int time_added_to_shared_memory;
|
2002-05-30 07:14:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct SCHED_SHMEM {
|
2002-06-01 20:26:21 +00:00
|
|
|
bool ready; // feeder sets to true when init done
|
2002-05-30 07:14:21 +00:00
|
|
|
// the following fields let the scheduler make sure
|
|
|
|
// that the shared mem has the right format
|
|
|
|
int ss_size; // sizeof(SCHED_SHMEM)
|
|
|
|
int platform_size; // sizeof(PLATFORM)
|
|
|
|
int app_size; // sizeof(APP)
|
|
|
|
int app_version_size; // sizeof(APP_VERSION)
|
|
|
|
int wu_result_size; // sizeof(WU_RESULT)
|
|
|
|
int nplatforms;
|
|
|
|
int napps;
|
2006-07-11 21:49:20 +00:00
|
|
|
double app_weights;
|
2002-05-30 07:14:21 +00:00
|
|
|
int napp_versions;
|
2004-09-24 20:17:52 +00:00
|
|
|
int ncore_versions;
|
2002-05-30 07:14:21 +00:00
|
|
|
int nwu_results;
|
|
|
|
int max_platforms;
|
|
|
|
int max_apps;
|
|
|
|
int max_app_versions;
|
2004-09-24 20:17:52 +00:00
|
|
|
int max_core_versions;
|
2002-05-30 07:14:21 +00:00
|
|
|
int max_wu_results;
|
|
|
|
PLATFORM platforms[MAX_PLATFORMS];
|
|
|
|
APP apps[MAX_APPS];
|
|
|
|
APP_VERSION app_versions[MAX_APP_VERSIONS];
|
|
|
|
WU_RESULT wu_results[MAX_WU_RESULTS];
|
|
|
|
|
|
|
|
void init();
|
|
|
|
int verify();
|
|
|
|
int scan_tables();
|
2004-06-17 23:23:13 +00:00
|
|
|
bool have_app(int);
|
2004-07-24 00:09:28 +00:00
|
|
|
bool no_work(int pid);
|
|
|
|
void restore_work(int pid);
|
2002-05-30 07:14:21 +00:00
|
|
|
|
|
|
|
APP* lookup_app(int);
|
|
|
|
APP_VERSION* lookup_app_version(int appid, int platform, int version);
|
|
|
|
PLATFORM* lookup_platform(char*);
|
|
|
|
};
|
|
|
|
|