1
Usos de comandos en terminales de distintos tipos de Sistemas operativos
(Actividad 2)
Dayron Farid Vera Castro
ingeniería de software, Universidad Manuela Beltrán.
Sistemas Operativos
Ing. Hernán Darío Cruz Bueno
Bogotá, Colombia
2
1. Abrir PowerShell en Windows y responder cual es la diferencia entre PowerShell y
cmd de windows
Consultar los comandos que permiten hacer lo siguiente en PowerShell:
• Información del hardware
• Información de la BIOS
• Muestra el usuario que está conectado en el sistema.
• Mostrar IP
• TOP 5 Procesos con más consumo
• Listar Ítems de directorio
• renombrar varios archivos a la vez
• calcular días, meses, minutos y segundos de una fecha (DD/MM/YYYY) a la fecha actual
• Con los resultados obtenidos realizar una tabla demostrativa en Word para así dar
respuesta al punto de la guía
2. Ejercicio 2: Valor (1.5)
Explain the differents methods for memory management
• First In First Out - FIFO
• Shortest Remaining Time (S.R.T.)
• Shortest-Job-First (S.J.F.)
• Round Robin
• Make a comparative table between the different algorithms of memory management,
explaining the advantages and disadvantages of each of them.
3. Ejercicio 3: Valor (2.0)
3
Make the analysis of four different processes initiated and the operation of each algorithm of.
• First In First Out - FIFO
• Shortest Remaining Time (S.R.T.)
• Shortest-Job-First (S.J.F.)
• Round Robin
Solución
4
Ejercicio 1
1. Con CMD cambie el color de la letra de la consola a azul, para poder diferenciar entre le
la terminal de CMD y PowerShell.
Para consultar la información del hardware dentro del CMD se utiliza el comando
Systeminfo.
Información del hardware
Systeminfo
Información de la BIOS: El BIOS de una computadora es la interfaz de firmware entre
el hardware de una computadora y su sistema operativo. Como cualquier software, el
BIOS se puede actualizar. Conocer la versión del BIOS de la computadora puede indicarle
si tiene la versión más actualizada del BIOS.
Información del BIOS
Get-WmiObject win32_bios 5
Muestra el usuario que está conectado en el sistema:
Usuario conectado al sistema
(Get-CimInstance -ClassName Win32_ComputerSystem)
• Mostrar IP:
Mostrar IP
(Invoke-WebRequest "http://www.jesusninoc.com").BaseResponse
(PowerShell)
6
• TOP 5 Procesos con más consumo
Procesos con más consumo
Ps | sort -p ws | select -last 5
• Listar Ítems de directorio
Get-childitem (PowerShell)
7
• Renombrar varios archivos a la vez
Renombrar varios archivos a la vez
Dir | Rename-Item -NewName { $_.name -replace "loqsereemplaza","lonuevo" }
(PowerShell)
• Calcular días, meses, minutos y segundos de una fecha (DD/MM/YYYY)
Get-Date
8
Diferencia entre PowerShell y CMD
CMD:
PowerShell:
• Mayor simplicidad en los
• Los comandos son mas
comandos
estructurados y son procesados
como objetos. • Lleva mucho tiempo sin
actualizarse
• Herramienta mas actualizada
• Cuando se trata de codificación
• Crear nuestros propios
en terminal las personas
comandos, esto gracias al
recurre más al terminal CMD
lenguaje C#
• Automatizar tareas mediante
• Ejecución remota de tareas
secuencias de comandos
• Ejecutar trabajos en segundo
• Poco intuitiva
plano
Ejercicio 2
Methods for memory management
• First In First Out – FIFO
The operating system maintains a list of concurrent pages in memory, with the top page
in the list being the oldest and the last page in the list being the last to arrive. In the event
9
of a missing page, the head page is replaced and the new page is added to the end of the
list.
Disadvantage: The oldest page can be heavily used by the others.
Example: Shared pages (reentrant code).
Two FIFO variants using R and M bits:
1.Extract the page of the lowest class by starting to look for the oldest page.
2.second chance: The oldest page is inspected as a potential victim. If its R bit is set to 0,
it is replaced and if it is set to 1 it is set to 0 and the page is put at the end of the list by
searching the next page in the list (if all pages have been referenced we will have pure
FIFO). The more pages the memory has, the less page faults a program has: Belady's
anomaly: FIFO causes more page faults with 4 pages than with 3 (it is a curiosity, it is not
an important result).
• Shortest Remaining Time (S.R.T.)
the process with the smallest amount of time remaining until completion is selected to
execute. Since the currently executing process is the one with the shortest amount of time
remaining by definition, and since that time should only reduce as execution progresses,
processes will always run until they complete or a new process is added that requires a
smaller amount of time.
• Shortest-Job-First (S.J.F.)
This algorithm helps OS to maintain an efficient manner in which input-output requests
can be managed to execute a process. There are various types of algorithms that an
operating system uses for scheduling a process to the CPU.
10
The SJF (Shortest Job First) scheduling algorithm in which the CPU executes the job first
has the shortest execution time. Also, the burst time is an important factor in SJF
scheduling.
Characteristics of SJF Scheduling
Following are the characteristics of (Shortest Job First) SJF scheduling program in C.
• This algorithm is related to each job as a unit of time for completion.
• This algorithm is helpful for those types of processing of jobs in which the completion time
of a job can be calculated easily like Batch-type processing.
• This algorithm can improve the CPU processing as it executes the shorter jobs first which
leads to a short turnaround time.
• Round Robin
Round Robin Scheduling Algorithm is a scheduling algorithm for time-sharing systems. It
is preemptive in nature that it switches between processes according to the time allotted
for each process. The time slice that is used to switch between the processes is known
as Quantum. Round Robin scheduling is cyclic in nature and is also known as Time Slicing
Scheduling.
11
Characteristics of Round Robin Scheduling in C
• Round Robin Scheduling follows a preemptive approach.
• It is used for time-sharing systems.
• It shares equal time intervals for all processes.
• Round Robin Scheduling is a starvation-free algorithm.
• The implementation of Round Robin Scheduling is simple and easy to use.
First In First Out - Shortest Shortest-Job-First Round Robin
FIFO Remaining Time (S.J.F.)
(S.R.T.)
-Shortest Job First
-The page that -Preemptive: - Push the first
has the shortest
has been resident SRTF is a process from
average waiting
in memory the preemptive ready queue
time out of all
longest is algorithm, which for the task to
scheduling
replaced memory means that the be executed
methods.
currently running for the allotted
-They should be
-SJF is
process can be time.
located in such a
categorized as a
interrupted if a new
way as to facilitate -In a similar
Greedy algorithm.
process arrives
as much as manner,
with a shorter burst
possible the another
- This algorithm
time.
removal of process is
can be utilized in
-Low waiting time:
products with a selected by the
specialized
SRTF is known for
shorter expiration ready queue to
environments
its low waiting time.
date.
where precise
12
-Dynamic: SRTF is burst time (or execute its
a dynamic running time of an task.
algorithm, which application)
- The above
means that it can estimations are
steps are
adapt to changes available.
repeated until
in the arrival time
all processes
and burst time of
are finished.
processes.
Ejercicio 3:
• Ejemplo A FIFO:
FIFO
Proceso Tf Tll t T W P
A 8 5 8 3 5 0,4
B 18 8 10 10 0 1
C 22 15 4 7 3 1,8
D 27 18 5 9 4 1,8
E 30 20 3 10 7 3,3
Promedio 7,8 3,8 1,66
13
Ejemplo B FIFO:
FIFO
Proceso Tf Tll t T W P
A 4 3 4 1 3 0,3
B 11 6 7 5 2 0,7
C 20 8 9 12 3 1,3
D 24 9 4 15 11 3,8
E 29 11 5 18 13 3,6
Promedio 10,2 6,4 1,94
• Ejemplo A Shortest-Job-First (S.J.F.):
Shortest-Job-First (S.J.F.
Proceso Tf Tll t T W P
A 2 2 2 0 2 0
B 5 4 3 1 2 0,3
C 10 6 5 4 1 0,8
E 14 8 4 6 2 1,5
D 23 10 9 13 4 1,4
Promedio 4,8 2,2 0,8
14
Ejemplo B Shortest-Job-First (S.J.F.):
Shortest-Job-First (S.J.F.
Proceso Tf Tll t T W P
A 7 5 7 2 5 0,3
B 16 8 9 8 1 0,9
C 20 10 4 10 6 2,5
E 26 13 6 13 7 2,2
D 34 15 8 19 11 2,4
Promedio 10,4 6 1,66
Ejemplo A Shortest Remaining Time (S.R.T.):
Shortest-Job-First (S.J.F.
Proceso Tf Tll t T W P
A 3 0 3 3 0 1
B 7 3 4 4 0 1
C 19 6 7 13 6 1,9
D 13 8 5 5 0 1
E 30 10 11 20 9 1,8
Promedio 9 3 1,34
15
Ejemplo B Shortest Remaining Time (S.R.T.):
Shortest-Job-First (S.J.F.
Proceso Tf Tll t T W P
A 11 1 8 10 2 1,3
B 7 4 3 3 0 1
C 23 8 6 15 9 2,5
D 17 10 4 7 3 1,8
E 14 12 2 2 0 1
Promedio 7,4 2,8 1,52
Ejemplo A Round Robin:
Round Robin
Proceso Tf Tll t T W P
A 2 2 2 0 2 0,0
B 7 6 3 1 2 0,3
C 9 10 4 -1 5 -0,3
D 19 14 6 5 1 0,8
E 23 16 8 7 1 0,9
Promedio 2,4 -2,2 0,4
16
Ejemplo B Round Robin:
Round Robin
Proceso Tf Tll t T W P
A 2 0 2 2 0 1,0
B 14 4 4 10 6 2,5
C 16 6 6 10 4 1,7
D 26 8 8 18 10 2,3
E 27 10 7 17 10 2,4
Promedio 11,4 6 2,0
Bibliografías:
• https://support.lenovo.com/au/es/solutions/ht070218
• https://es.quora.com/Cu%C3%A1l-es-la-diferencia-entre-CMD-y-Powershell
• https://w3.ual.es/~rguirado/so/tema5.pdf
17
• https://www.geeksforgeeks.org/shortest-remaining-time-first-preemptive-sjf-
scheduling-algorithm/
• https://www.scaler.com/topics/sjf-scheduling-in-c/
• https://www.scaler.com/topics/round-robin-scheduling-program-in-c/