Example #1
0
        /// <summary>
        /// 流程过程中更新单据
        /// </summary>
        public override void UpdateBill(EnumProcessState state)
        {
            DynamicParameters parameters = new DynamicParameters();

            parameters.Add("ProcessId", ProcessId);
            WfFormInstance form = DbSession.QueryFirstOrDefaultWhere <WfFormInstance>("ProcessId=@ProcessId", parameters);

            if (form == null)
            {
                return;
            }
            //更新到单据表
            if (state == EnumProcessState.Startup)
            {
                base.UpdateBillDataWhenStartup(form.AppInstanceTableName, form.AppInstanceId);
            }
            else if (state == EnumProcessState.Processing)
            {
                base.UpdateBillDataWhenProcessing(form.AppInstanceTableName, form.AppInstanceId);
            }
            else if (state == EnumProcessState.Completed)
            {
                base.UpdateBillDataWhenComplete(form.AppInstanceTableName, form.AppInstanceId);
            }
        }
 /// <summary>
 /// Constructor for process control block with construction flags
 /// </summary>
 /// <param name="flags"> flags to use to construct this PCB</param>
 public ProcessControlBlock(PCBFlags flags)
 {
     this.CPUID           = flags.CPUID;
     this.OSID            = flags.OSID;
     this.processID       = flags.processID;
     this.ProcessName     = flags.processName;
     this.processState    = flags.processState;
     this.programName     = flags.programName;
     this.baseAddress     = flags.baseAddress;
     this.startAddress    = flags.startAddress;
     this.processPriority = flags.processPriority;
     this.avgBurstTime    = flags.avgBurstTime;
     this.avgWaitingTime  = flags.avgWaitingTime;
     this.resourceStarved = flags.resourceStarved;
     if (flags.allocatedResources == null)
     {
         this.allocatedResources = new List <SimulatorResource>();
     }
     else
     {
         this.allocatedResources = flags.allocatedResources;
     }
     if (flags.requestedResources == null)
     {
         this.allocatedResources = new List <SimulatorResource>();
     }
     else
     {
         this.allocatedResources = flags.allocatedResources;
     }
     this.specialRegisters = flags.specialRegisters;
     this.registers        = flags.registers;
     this.lifetimeMills    = flags.lifetimeMills;
 }
Example #3
0
 public bool isResourceStarved()
 {
     if (resourceStarved)
     {
         currentState = EnumProcessState.WAITING;
         return(true);
     }
     return(false);
 }
Example #4
0
 /// <summary>
 /// Constructor for a process
 /// </summary>
 /// <param name="flags"> the flags to create this process with</param>
 public SimulatorProcess(ProcessFlags flags)
 {
     this.program               = flags.program;
     this.programName           = flags.programName;
     this.processName           = flags.processName;
     this.processPriority       = flags.processPriority;
     this.processMemory         = flags.processMemory;
     this.processLifetime       = flags.processLifetime;
     this.processID             = flags.processID;
     this.CPUID                 = flags.CPUid;
     this.burstTime             = flags.burstTime;
     this.displayProfile        = flags.displayProfile;
     this.parentDiesChildrenDie = flags.parentDiesChildrenDie;
     this.delayedProcess        = flags.delayedProcess;
     this.delayedProcessTime    = flags.delayedProcessTime;
     this.delayTimeUnit         = flags.delayTimeUnit;
     this.parentProcess         = flags.parentProcess;
     if (parentProcess != null)
     {
         parentProcessID = parentProcess.processID;
     }
     else
     {
         parentProcessID = -1;
     }
     this.childProcesses      = flags.childProcesses;
     this.processSwapped      = flags.processSwapped;
     this.currentState        = flags.processState;
     this.previousState       = flags.previousState;
     this.resourceStarved     = flags.resourceStarved;
     this.allocatedResources  = flags.allocatedResources;
     this.requestedResources  = flags.requestedResources;
     this.processControlBlock = flags.processControlBlock;
     this.OSid                = flags.OSid;
     this.clockSpeed          = flags.clockSpeed;
     this.unit                = new ProcessExecutionUnit(this, clockSpeed);
     this.lotteryTickets      = flags.lotteryTickets;
     this.ownsSemaphore       = flags.ownsSemaphore;
     this.waitingForSemaphore = flags.waitingForSemaphore;
 }
Example #5
0
 public abstract void UpdateBill(EnumProcessState state);