## 3 Materials and Methods
### Hybrid DRLCC Framework
#### 3.2.2 Module 2: Concurrency Layer (Dynamic Priority Ceiling Protocol)  
The Concurrency Layer enforces mutual exclusion and prevents priority inversion by combining a classic Priority Ceiling Protocol (PCP) with dynamic updates driven by real-time queue information. Dynamic ceiling calculation: In a traditional PCP, each resource's ceiling is statically set to the maximum priority of all tasks that might ever use it. However, our manufacturing workloads are dynamic: job arrivals, cancellations, and completion changes, which tasks are contending for each AMR. To accommodate this, we recompute each AMR's ceiling at every decision point, the dynamic variant shown in Figure 5. Each resource (AMR) in our system is assigned a priority ceiling that is dynamically recalculated in real time. Instead of being fixed, the ceiling is updated by continuously evaluating the waiting job queue, identifying the highest-priority job among those potentially requesting a specific resource. \[ceiling_{r}(t)=\mathop{\mathit{max}}\limits_{j\in Q(t)\wedge r\in feasible(j)} \ priority(j) \tag{3}\]  
where \(Q_{t}\) is the set of jobs waiting at the time \(t\). Figure 4: DRLCC framework. Figure 5: Flowchart of our dynamic Priority Ceiling Protocol for AMR allocation. When a robot becomes idle, a request from a waiting job triggers a priority check and real-time ceiling adjustment (the ceiling is set to the highest priority among queued jobs). If the requesting job’s priority meets or exceeds this ceiling, the robot is locked, and the task proceeds; otherwise, access is denied, and the job remains in the queue. Once the task finishes, the robot is released, and its ceiling is recomputed before the next allocation. Resource acquisition and blocking logic: When a job reaches the front of the queue, it attempts to acquire an AMR. The Concurrency Layer imposes three simultaneous conditions:  
1. Resource Availability: The AMR must be currently free (unoccupied by another job). 2. Battery Threshold: AMR's payload capacity must meet the job's load weight. The AMR must either not be charging with battery > 0.30, or if charging, have battery > 0.25. \[amr.capacity\geq job.load\_weight\] (4)
3. Ceiling check: The requested job's priority must be greater than or equal to the dynamically updated ceiling of the targeted AMR. \[job.priority\geq amr.ceiling\] (5)  
Unlike the strict \"greater than\" priority condition typically found in standard PCP implementations, our protocol employs a \"greater than or equal to\" condition. This approach provides enhanced flexibility, ensuring more responsive and dynamic resource allocation in rapidly evolving manufacturing scenarios. Only AMRs satisfying all three conditions are deemed feasible. If these conditions are not met, the requested job enters a waiting state. During this waiting period, the system actively monitors and records delays, the number of times jobs are blocked, and occurrences of potential priority inversion scenarios, specifically when a high-priority job is delayed by a lower-priority task occupying an AMR. As jobs finish and release resources, priority ceilings are recalculated based on the real-time status of the waiting queue. This continuous recalibration significantly reduces improper resource allocation and effectively mitigates priority inversion. Integration with the scheduling loop: Within the main task handler, the Concurrency Layer is seamlessly woven into the scheduling loop. After ceilings are updated, the job builds its list of feasible AMRs; if non-empty, it invokes the DRL agent to select one, then double-checks that the chosen AMR still meets all PCP constraints before assignment. If at any point the chosen AMR fails a check (e.g., its battery dips), the job briefly yields and retries without penalizing the agent. This tight interplay between dynamic PCP filtering, blocking/inversion detection, and RL-driven action selection ensures the following:  
* No high-priority job is indefinitely postponed by a lower-priority one.