0% found this document useful (0 votes)
58 views4 pages

Programming Language:: Swift

Swift is a general-purpose programming language developed by Apple as a replacement for Objective-C, supporting modern programming concepts. AppleScript is a scripting language that allows automated control over Mac applications using Apple events. Common scheduling algorithms used include round-robin, which allocates equal time slices to each process in circular order, and multilevel feedback queue scheduling, which analyzes process behavior over time to change priorities.

Uploaded by

M Saleh Butt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views4 pages

Programming Language:: Swift

Swift is a general-purpose programming language developed by Apple as a replacement for Objective-C, supporting modern programming concepts. AppleScript is a scripting language that allows automated control over Mac applications using Apple events. Common scheduling algorithms used include round-robin, which allocates equal time slices to each process in circular order, and multilevel feedback queue scheduling, which analyzes process behavior over time to change priorities.

Uploaded by

M Saleh Butt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Programming Language:

 Objective C++(both Objective-C and C++ ), kernel is in C .


 Modern Mac OS uses Swift language for application Development.

Swift:
Swift is a general-purpose, multi-paradigm, compiled programming
language developed by Apple Inc. and the open-source community, first released in
2014. Swift was developed as a replacement for Apple's earlier programming
language Objective-C, as Objective-C had been largely unchanged since the early 1980s
and lacked modern language features. Swift works with Apple's Cocoa and Cocoa Touch
frameworks, and a key aspect of Swift's design was the ability to interoperate with the
huge body of existing Objective-C code developed for Apple products over the previous
decades. It is built with the open source LLVM compiler framework and has been
included in Xcode since version 6, released in 2014. On Apple platforms, it uses the
Objective-C runtime library which allows C, Objective-C, C++ and Swift code to run
within one program. . Swift took language ideas from Objective-C, Rust, Haskell, Ruby,
Python, C#, CLU, and far too many others to list. Swift is an alternative to the Objective-
C language that employs modern programming-language theory concepts and strives to
present a simpler syntax. During its introduction, it was described simply as "Objective-C
without the baggage of C".

By default, Swift does not expose pointers and other unsafe accessors, in contrast to
Objective-C, which uses pointers pervasively to refer to object instances. Also,
Objective-C's use of a Smalltalk-like syntax for making method calls has been replaced
with a dot-notation style and namespace system more familiar to programmers from
other common object-oriented (OO) languages like Java or C#. Swift introduces true
named parameters and retains key Objective-C concepts, including protocols, closures
and categories, often replacing former syntax with cleaner versions and allowing these
concepts to be applied to other language structures, like enumerated types enums.
Unlike Windows, developer knows for which machine the application is being developed
and swift is designed for specifically run on apple mac and developer is specific about
hardware for which he is developing.
Access Control
Swift supports five access control levels for symbols: open, public, internal,
fileprivate, and private. Unlike many object-oriented languages, these access
controls ignore inheritance hierarchies: private indicates that a symbol is
accessible only in the immediate scope, fileprivate indicates it is accessible only
from within the file, internal indicates it is accessible within the containing
module, public indicates it is accessible from any module, and open (only for
classes and their methods) indicates that the class may be subclassed outside of
the module.

 AppleScript:
AppleScript is a scripting language created by Apple Inc. that facilitates automated control
over scriptable Mac applications. First introduced in System 7, it is currently included in all
versions of macOS as part of a package of system automation tools. The term "AppleScript"
may refer to the language itself, to an individual script written in the language, or,
informally, to the macOS Open Scripting Architecture that underlies the language.
AppleScript was designed to be used as an accessible end-user scripting language, offering users an
intelligent mechanism to control applications, and to access and modify data and documents. AppleScript
uses Apple events, a set of standardized data formats that the Macintosh operating system uses to send
information to applications, roughly analogous to sending XPath queries over XML-RPC in the world
of web services. Apple events allow a script to work with multiple applications simultaneously, passing
data between them so that complex tasks can be accomplished without human interaction. For example,
an AppleScript to create a simple web gallery might do the following:

1. Open a photo in a photo-editing application (by sending that application


an Open File Apple event).
2. Tell the photo-editing application to manipulate the image (e.g. reduce its
resolution, add a border, add a photo credit)
3. Tell the photo-editing application to save the changed image in a file in some
different folder (by sending that application a Save and/or Close Apple event).
4. Send the new file path (via another Apple event) to a text editor or web editor
application
5. Tell that editor application to write a link for the photo into an HTML file.
6. Repeat the above steps for an entire folder of images (hundreds or even
thousands of photos).
7. Upload the HTML file and folder of revised photos to a website, by sending
Apple events to a graphical FTP client, by using built-in AppleScript commands, or by sending Apple
events to Unix FTP utilities.
For the user, hundreds or thousands of steps in multiple applications have been reduced to the single
act of running the script, and the task is accomplished in much less time and with no possibility of
random human error. A large complex script could be developed to run only once, while other scripts
are used again and again.

Algorithms:
Two major algorithms are used
Round Robin (RR):
The name of the algorithm comes from the round-robin principle known from
other fields, where each person takes an equal share of something in turn. Round-
robin (RR) is one of the algorithms employed by process and network
schedulers in computing. As the term is generally used, time slices (also known as time
quanta) are assigned to each process in equal portions and in circular order, handling all
processes without priority (also known as cyclic executive). Round-robin scheduling is
simple, easy to implement, and starvation-free. Round-robin scheduling can be applied to
other scheduling problems, such as data packet scheduling in computer networks. To
schedule processes fairly, a round-robin scheduler generally employs time-sharing, giving
each job a time slot or quantum (its allowance of CPU time), and interrupting the job if it is
not completed by then. The job is resumed next time a time slot is assigned to that process.
If the process terminates or changes its state to waiting during its attributed time quantum,
the scheduler selects the first process in the ready queue to execute. In the absence of time-
sharing, or if the quanta were large relative to the sizes of the jobs, a process that produced
large jobs would be favoured over other processes.
Round-robin algorithm is a pre-emptive algorithm as the scheduler forces the process out of the
CPU once the time quota expires.
For example, if the time slot is 100 milliseconds, and job1 takes a total time of 250 ms to complete,
the round-robin scheduler will suspend the job after 100 ms and give other jobs their time on the
CPU. Once the other jobs have had their equal share (100 ms each), job1 will get another allocation
of CPU time and the cycle will repeat. This process continues until the job finishes and needs no
more time on the CPU.

Job1 = Total time to complete 250 ms (quantum 100 ms).

1. First allocation = 100 ms.


2. Second allocation = 100 ms.
3. Third allocation = 100 ms but job1 self-terminates after 50 ms.
4. Total CPU time of job1 = 250 ms

Multilevel Feedback Queue Scheduling (MLFQ):


This Scheduling is like Multilevel Queue (MLQ) Scheduling but in this process can move
between the queues. This movement is facilitated by the characteristic of the CPU burst of the
process. If a process uses too much CPU time, it will be moved to a lower-priority queue. This
scheme leaves I/O-bound and interactive processes in the higher priority queues. In addition, a
process that waits too long in a lower-priority queue may be moved to a higher priority queue.
This form of aging also helps to prevent starvation of certain lower priority processes.
 Multilevel Feedback Queue Scheduling (MLFQ) keep analyzing the behavior (time of execution)
of processes and according to which it changes its priority.
Advantages:

  It is more flexible than the multilevel queue scheduling.

 To optimize turnaround time algorithms like SJF is needed which require the running
time of processes to schedule them. But the running time of the process is not known in
advance. MFQS runs a process for a time quantum and then it can change its priority (if
it is a long process). Thus it learns from past behavior of the process and then predicts
its future behavior. This way it tries to run shorter process first thus optimizing
turnaround time.

 MFQS also reduces the response time.

You might also like