+ {process.pid !== undefined && (
+
+ #{process.pid}
+
+ )}
{process.name}
{bound}
@@ -47,7 +52,7 @@ const ProcessCard = ({ process, onEdit, onRemove }: ProcessCardProps) => {
{/* Actions */}
-
+
{
setArrivalTime(editingProcess.arrivalTime);
setPriority(editingProcess.priority);
setColor(editingProcess.color);
- setBursts([...editingProcess.bursts.map(b => ({ ...b }))]);
+ setBursts([...editingProcess.bursts.map((b: BurstSegment) => ({ ...b }))]);
} else {
setName('');
setArrivalTime(0);
@@ -89,15 +89,14 @@ const ProcessForm = ({ editingProcess, onClose }: ProcessFormProps) => {
if (isEditing && editingProcess) {
updateProcess(editingProcess.id, { name: name.trim(), arrivalTime, priority, color, bursts });
} else {
- const p: Process = {
+ addProcess({
id: generateId(),
name: name.trim(),
arrivalTime,
priority,
color,
bursts,
- };
- addProcess(p);
+ });
}
onClose();
};
@@ -141,7 +140,7 @@ const ProcessForm = ({ editingProcess, onClose }: ProcessFormProps) => {
type="color"
value={color}
onChange={e => setColor(e.target.value)}
- className="h-[34px] w-12 rounded-md border border-slate-600 bg-slate-700 cursor-pointer"
+ className="h-8.5 w-12 rounded-md border border-slate-600 bg-slate-700 cursor-pointer"
aria-label="Cor do processo"
/>
diff --git a/src/components/SchedulerPanel/AlgorithmSelector.tsx b/src/components/SchedulerPanel/AlgorithmSelector.tsx
index a4c8d5a..abc9f67 100644
--- a/src/components/SchedulerPanel/AlgorithmSelector.tsx
+++ b/src/components/SchedulerPanel/AlgorithmSelector.tsx
@@ -10,7 +10,7 @@ const ALGORITHM_OPTIONS: { value: SchedulingAlgorithm; label: string; disabled?:
{ value: 'PRIORITY_P', label: 'Priority (Preemptivo)' },
{ value: 'PRIORITY_RR',label: 'Priority Round Robin (tempo real)' },
{ value: 'HRRN', label: 'HRRN — Highest Response Ratio Next' },
- { value: 'MULTILEVEL', label: 'Multilevel Queue (em breve)', disabled: true },
+ { value: 'MULTILEVEL', label: 'Multilevel Queue (MLQ)' },
];
const AlgorithmSelector = () => {
diff --git a/src/components/SchedulerPanel/SchedulerConfig.tsx b/src/components/SchedulerPanel/SchedulerConfig.tsx
index 9515eb4..b089fec 100644
--- a/src/components/SchedulerPanel/SchedulerConfig.tsx
+++ b/src/components/SchedulerPanel/SchedulerConfig.tsx
@@ -1,8 +1,9 @@
+import { Plus, Trash2 } from 'lucide-react';
import { useProcessStore } from '../../store/processStore';
-import type { SchedulingAlgorithm } from '@core/types';
+import type { MlqQueueDef, SchedulingAlgorithm } from '@core/types';
-// Algorithms that require a quantum parameter
-const QUANTUM_ALGORITHMS = new Set
(['RR', 'PRIORITY_RR', 'MULTILEVEL']);
+// Algorithms that require a global quantum parameter
+const QUANTUM_ALGORITHMS = new Set(['RR', 'PRIORITY_RR']);
// Algorithms where aging (anti-starvation) is applicable
const AGING_ALGORITHMS = new Set(['PRIORITY_NP', 'PRIORITY_P', 'PRIORITY_RR']);
@@ -44,6 +45,114 @@ const ToggleRow = ({
);
+const MLQ_ALGO_OPTIONS: MlqQueueDef['algorithm'][] = ['RR', 'PRIORITY_NP', 'FCFS'];
+
+const MlqQueuesConfig = ({
+ queues,
+ onChange,
+}: {
+ queues: MlqQueueDef[];
+ onChange: (queues: MlqQueueDef[]) => void;
+}) => {
+ const update = (idx: number, patch: Partial